Я в настоящее время работаю над системой диалога в Годоте 4, используя Диалоговый менеджер 3. Я создал функцию «CheckDialogueFined», чтобы проверить, закончилось ли событие диалога. Это должно быть подписано на функцию «проверка», но никогда не так. Любая помощь будет оценена, tyia! < /P>
using Godot;
using System;
using DialogueManagerRuntime;
public partial class ObjectInteract : Node {
private Resource dialogue = GD.Load("res://Dialogue/Test.dialogue");
private bool isInDialogue = false;
/*
Function Desc: Gets the distance between an object and the player via slope
@param ObjectX -> x-coordinate of the Object
@param ObjectY -> y-coordinate of the Object
@param PlayerX -> x-coordinate of the Player
@param PlayerY -> y-coordinate of the Player
*/
public float getDistanceSlope(float ObjectX, float ObjectY, float PlayerX, float PlayerY){
float dx = ObjectX - PlayerX;
float dy = ObjectY - PlayerY;
float distance = dx * dx + dy * dy;
float trueDistance = (float)Math.Sqrt(distance);
return distance;
}
/*
Function Desc: Checks whether the player is close enough to interact with the object
@param slope -> Distance between object and player
@param objectName -> Name of the object
*/
public void checkInteract(float slope){
if (slope < 850 && Input.IsActionJustPressed("interact") && !isInDialogue){
DialogueManager.ShowExampleDialogueBalloon(dialogue);
isInDialogue = true;
DialogueManager.DialogueEnded += checkDialogueFinished;
GD.Print("Event fired!");
}
}
private void checkDialogueFinished(Resource dialogue) {
GD.Print("Event ended, setting isInDialogue back to false!");
isInDialogue = false;
DialogueManager.DialogueEnded -= checkDialogueFinished;
}
}
Я попытался проверить DialogueManagerRuntime, но все еще не нашел решение.
Я в настоящее время работаю над системой диалога в Годоте 4, используя Диалоговый менеджер 3. Я создал функцию «CheckDialogueFined», чтобы проверить, закончилось ли событие диалога. Это должно быть подписано на функцию «проверка», но никогда не так. Любая помощь будет оценена, tyia! < /P> [code]using Godot; using System; using DialogueManagerRuntime;
public partial class ObjectInteract : Node { private Resource dialogue = GD.Load("res://Dialogue/Test.dialogue"); private bool isInDialogue = false;
/* Function Desc: Gets the distance between an object and the player via slope @param ObjectX -> x-coordinate of the Object @param ObjectY -> y-coordinate of the Object @param PlayerX -> x-coordinate of the Player @param PlayerY -> y-coordinate of the Player */ public float getDistanceSlope(float ObjectX, float ObjectY, float PlayerX, float PlayerY){ float dx = ObjectX - PlayerX; float dy = ObjectY - PlayerY; float distance = dx * dx + dy * dy; float trueDistance = (float)Math.Sqrt(distance);
return distance; } /* Function Desc: Checks whether the player is close enough to interact with the object @param slope -> Distance between object and player @param objectName -> Name of the object */ public void checkInteract(float slope){ if (slope < 850 && Input.IsActionJustPressed("interact") && !isInDialogue){ DialogueManager.ShowExampleDialogueBalloon(dialogue); isInDialogue = true;