Implemented first demo quest line #15
@@ -116,6 +116,7 @@ directories/tres_directory={
|
||||
"4_collect_tools": "res://resources/quests/demo/4_collect_tools.tres",
|
||||
"5_talk_yeli_3": "res://resources/quests/demo/5_talk_yeli_3.tres",
|
||||
"6_till_and_water": "res://resources/quests/demo/6_till_and_water.tres",
|
||||
"7_talk_yeli_inside_1": "res://resources/quests/demo/7_talk_yeli_inside_1.tres",
|
||||
"Babushka_NPC_Namebox_background": "res://dialog/Babushka_NPC_Namebox_background.tres",
|
||||
"InputFieldsStyle": "res://addons/dialogic/Editor/Events/styles/InputFieldsStyle.tres",
|
||||
"MainTheme": "res://addons/dialogic/Editor/Theme/MainTheme.tres",
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_resource type="Resource" script_class="QuestResource" load_steps=2 format=3 uid="uid://byjqeukpibkvi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://vji5lp4qc8pp" path="res://scripts/CSharp/Common/Quest/QuestResource.cs" id="1_f2jsb"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_f2jsb")
|
||||
id = "7_talk_yeli_inside_1"
|
||||
title = "Talk to Yeli in the house"
|
||||
description = "Go inside the house and find yeli again"
|
||||
metadata/_custom_type_script = "uid://vji5lp4qc8pp"
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=113 format=3 uid="uid://gigb28qk8t12"]
|
||||
[gd_scene load_steps=119 format=3 uid="uid://gigb28qk8t12"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"]
|
||||
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
|
||||
@@ -73,6 +73,10 @@
|
||||
[ext_resource type="Resource" uid="uid://d2swjixbnqkbw" path="res://resources/quests/demo/4_collect_tools.tres" id="68_lbnqo"]
|
||||
[ext_resource type="Script" uid="uid://be54lnb6gg81f" path="res://scripts/CSharp/Common/Inventory/ItemInstance.cs" id="69_4rgbr"]
|
||||
[ext_resource type="Resource" uid="uid://5t8g0firdif0" path="res://resources/quests/demo/5_talk_yeli_3.tres" id="69_l4wxt"]
|
||||
[ext_resource type="Script" uid="uid://bhbldab74vmhy" path="res://scripts/CSharp/Common/QuestBehaviour/DetectFieldWork.cs" id="74_fv1t2"]
|
||||
[ext_resource type="Resource" uid="uid://h05jgxqtq37m" path="res://resources/quests/demo/6_till_and_water.tres" id="75_l7ekk"]
|
||||
[ext_resource type="Resource" uid="uid://byjqeukpibkvi" path="res://resources/quests/demo/7_talk_yeli_inside_1.tres" id="76_xcwle"]
|
||||
[ext_resource type="Script" uid="uid://dih1b0opgc3f7" path="res://scripts/GdScript/dialogic_start_specific.gd" id="77_l7ekk"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wtdui"]
|
||||
shader = ExtResource("13_7p0hq")
|
||||
@@ -2388,6 +2392,15 @@ _itemsToContain = Array[Resource]([SubResource("Resource_y820s"), SubResource("R
|
||||
_onActiveQuest = ExtResource("68_lbnqo")
|
||||
_toNextQuest = ExtResource("69_l4wxt")
|
||||
|
||||
[node name="FieldWorkTrigger" type="Node" parent="SpeicialQuestTrigger"]
|
||||
script = ExtResource("74_fv1t2")
|
||||
_onActiveQuest = ExtResource("75_l7ekk")
|
||||
_toNextQuest = ExtResource("76_xcwle")
|
||||
|
||||
[node name="StartDialog" type="Node" parent="SpeicialQuestTrigger/FieldWorkTrigger"]
|
||||
script = ExtResource("77_l7ekk")
|
||||
timeline = "quest2_tomatoes_end"
|
||||
|
||||
[connection signal="FilledWateringCan" from="YSorted/Vesna" to="Audio/SFX/FillWater SFX2" method="PlayOneShot"]
|
||||
[connection signal="WateringField" from="YSorted/Vesna/FarmingControls" to="Audio/SFX/Watering SFX" method="PlayOneShot"]
|
||||
[connection signal="InteractedTool" from="YSorted/Brünnen/InteractionArea" to="YSorted/Vesna" method="TryFillWateringCan"]
|
||||
@@ -2406,6 +2419,7 @@ _toNextQuest = ExtResource("69_l4wxt")
|
||||
[connection signal="Dialogue" from="YSorted/ducks/DialogicToggle" to="YSorted/ducks/dialogic starter" method="open"]
|
||||
[connection signal="finished" from="Audio/Background Music Ramp up" to="Audio/Background Music loop" method="PlayFromOffset"]
|
||||
[connection signal="ready" from="SpeicialQuestTrigger/QuestInstantStart" to="SpeicialQuestTrigger/QuestInstantStart/QuestTrigger" method="Trigger"]
|
||||
[connection signal="OnFulfilled" from="SpeicialQuestTrigger/FieldWorkTrigger" to="SpeicialQuestTrigger/FieldWorkTrigger/StartDialog" method="start"]
|
||||
|
||||
[editable path="YSorted/Vesna"]
|
||||
[editable path="YSorted/Brünnen/InteractionArea"]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Farming;
|
||||
|
||||
/// <summary>
|
||||
@@ -26,6 +28,7 @@ public static class WateringCanState
|
||||
|
||||
public delegate void WateringCanDelegate(bool state);
|
||||
public static event WateringCanDelegate WateringCanActiveStateChanged;
|
||||
public static event Action? OnWater;
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +46,10 @@ public static class WateringCanState
|
||||
public static void Water()
|
||||
{
|
||||
if(_fillstate > 0)
|
||||
{
|
||||
_fillstate--;
|
||||
OnWater?.Invoke();
|
||||
|
Jonathan marked this conversation as resolved
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Babushka.scripts.CSharp.Common.Farming;
|
||||
using Babushka.scripts.CSharp.Common.Quest;
|
||||
|
||||
public partial class DetectFieldWork : QuestFulfillmentBase
|
||||
{
|
||||
private int wateredCounter = 0;
|
||||
|
||||
[Export] private int _wateringNeeded = 5;
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
WateringCanState.OnWater += CountWater;
|
||||
QuestManager.Instance!.QuestsChanged += CheckFieldWork;
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
WateringCanState.OnWater -= CountWater;
|
||||
QuestManager.Instance!.QuestsChanged -= CheckFieldWork;
|
||||
}
|
||||
|
||||
public void CountWater()
|
||||
{
|
||||
wateredCounter++;
|
||||
CheckFieldWork();
|
||||
}
|
||||
|
||||
public void CheckFieldWork()
|
||||
{
|
||||
if (IsQuestActive() && wateredCounter >= _wateringNeeded)
|
||||
{
|
||||
Fulfill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bhbldab74vmhy
|
||||
@@ -1,6 +0,0 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class DetectToolCollection : Node
|
||||
{
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://caohn76m3n3nm
|
||||
@@ -3,6 +3,12 @@ using System;
|
||||
using System.Linq;
|
||||
using Babushka.scripts.CSharp.Common.Quest;
|
||||
|
||||
/// <summary>
|
||||
/// Acts as a base for scripts to check for conditions to complete quests.
|
||||
///
|
||||
/// The derived Class is responsible for triggering the Check.
|
||||
/// It is recommended to always check on QuestManager.Instance!.QuestsChanged
|
||||
/// </summary>
|
||||
public abstract partial class QuestFulfillmentBase : Node
|
||||
{
|
||||
[Export] private QuestResource _onActiveQuest;
|
||||
@@ -12,6 +18,8 @@ public abstract partial class QuestFulfillmentBase : Node
|
||||
[Export] private bool _whenFulfilledSetNextQuestToActive = true;
|
||||
[Export] private bool _whenFulfilledSetNextQuestToFollow = true;
|
||||
|
Jonathan marked this conversation as resolved
kziolkowski
commented
Hatten wir uns nicht auf ein anderes Wording geeinigt oder hat es einen Grund, warum es jetzt wieder 'Active' und 'Follow' heißt? Hatten wir uns nicht auf ein anderes Wording geeinigt oder hat es einen Grund, warum es jetzt wieder 'Active' und 'Follow' heißt?
|
||||
|
||||
[Signal] private delegate void OnFulfilledEventHandler();
|
||||
|
||||
protected void Fulfill()
|
||||
{
|
||||
if (_whenFulfilledSetActiveQuestToDone)
|
||||
@@ -26,6 +34,8 @@ public abstract partial class QuestFulfillmentBase : Node
|
||||
{
|
||||
QuestManager.Instance!.SetFollowQuest(_toNextQuest);
|
||||
}
|
||||
|
||||
EmitSignalOnFulfilled();
|
||||
}
|
||||
|
||||
protected bool IsQuestActive()
|
||||
|
||||
@@ -17,7 +17,7 @@ public partial class SceneTransition : Node
|
||||
public void LoadSceneAtIndex(int index)
|
||||
{
|
||||
string sceneName = _sceneNamesToLoad[index];
|
||||
SceneTransitionThreaded.Instance.ChangeSceneToFileThreaded(sceneName);
|
||||
SceneTransitionThreaded.Instance.ChangeSceneToFile(sceneName);
|
||||
UnloadAfterDelay();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
extends Node
|
||||
class_name DialogicStartSpecific
|
||||
|
Jonathan marked this conversation as resolved
kziolkowski
commented
Ich finde das naming hier nicht ganz passend:
Ich finde das naming hier nicht ganz passend:
- `DialogicStartSpecific` ist ironischerweise etwas unspezifisch, weil ich daraus nicht unbedingt ableiten kann, inwiefern es sich vom `DialogicStarter` unterscheidet. Letzterer spielt ja auch eine spezifische timeline ab, nur eben als Parameter.
- Ich glaube, ich würde den code einfach mit in den vorhandenen DialogicStarter hinzufügen.
- Ich habe jetzt mehrere Minuten lang geglaubt, dass diese Klasse zu Beginn einer Szene automatisch die Timeline starten würde, weil du die Funktion `Start` genannt hast. Bitte keine Standardfunktionsnamen aus Unity verwenden, weil das super verwirrend ist.
Jonathan
commented
Genau das ist der Unterschied: Ich habe dir zuliebe die Funktion aber umbenannt. Genau das ist der Unterschied: `DialogicStarter` startet irgendeinen Dialog, den man als Parameter mitgeben kann. Und `DialogicStartSpecific` startet einen spezifischen Dialog, der schon vorher festgelegt werden muss.
Ich habe dir zuliebe die Funktion aber umbenannt.
|
||||
|
||||
@export var timeline : String
|
||||
|
||||
func start():
|
||||
Dialogic.start(timeline)
|
||||
@@ -0,0 +1 @@
|
||||
uid://dih1b0opgc3f7
|
||||
Reference in New Issue
Block a user
Wofür genau soll diese Action nachher verwendet werden?
Wenn das signalisieren soll, wenn Vesna sich auf einer Watered-Tile befindet (z.B. für Geh-Sounds), dann würde ich dafür vermutlich eher den Fieldservice verwenden.
Das wird immer aufgerufen, wenn etwas gegossen wird. Das ist ne Quick-and-dirty-Lösung, die von
QuestBehaviour/DetectFieldWork.csgenutzt wird, um Feldarbeit als abgeschlossen zu erkennen.