如何在 Nathan Hoad 的 Godot 对话管理器中查看对话是否结束

问题描述 投票:0回答:1

我想取消对话期间移动的能力,但我找不到方法或其他东西来告诉我对话是否已退出以重新激活移动能力。就像标题中所说,我正在与 Nathan Hoad 的 Godot 对话管理器一起工作。我是个初学者,所以解决方案可能是显而易见的

我尝试查看对话管理器方法,但找不到任何东西

dialog godot
1个回答
0
投票

不确定这是否对您有帮助,因为已经 28 天没有人回复了。

我也刚刚开始使用 Godot 进行开发,并想到了和你类似的事情。

我发现了 Nathan Hoad 的教程,它可能在某些方面对你有帮助。请注意,某些视频可能没有您正在寻找的内容,因此如果您计划添加更多内容,请务必检查他的其他视频和其他内容创建者视频,并利用您的解决方案发挥创意:D。如果你正在制作 3D 游戏,我强烈推荐 FinePointCGI 恐怖游戏教程。

这是我提到的这个视频的链接:https://www.youtube.com/watch?v=hKQ_s5tl4dI(2:04 的某个地方)

解决方案总结

  1. 我的方法是创建一个全局布尔变量,因此当玩家与交互对象交互时,该变量变为 true/false (取决于您的编码风格)。这部分将是一个 if/else 语句

  2. 当输入 if/else 语句时,全局布尔变量将更新为 false/true AND 运行 DialogueManager 代码来运行对话

  3. 在球员移动方面,你必须发挥创意。使用全局布尔变量来限制你的玩家移动,也许让你的玩家移动速度为0。

  4. 为了确保你的玩家能够再次移动,请更新气球内的全局布尔变量。gd

补充 我还发现您可以向交互按钮发送垃圾邮件,并且交互会不断堆积,因此这种方法也将有所帮助。

balloon.gd 内的代码

var dialogue_line: DialogueLine:
    set(next_dialogue_line):
        if next_dialogue_line == null:
            globalVariable.globalBoolean= false
            #globalVariable is the name of autoload node script given. Refer the next code section i gave to see how to create this variable
            #globalBoolean is the name of the variable inside the autoload script
        
       #rest of the code that already exist

全局变量脚本内的代码(自动加载脚本)

extends Node

var globalBoolean: bool = false
#To create this, go to Project Settings>Autoload>Create this script and add path, and then name the Node

对象播放器内的代码与

交互
func someInteractionFunction():
    if not globalVariable.globalBoolean: #not depends on your coding style
            globalVariable.globalBoolean = true
            DialogueManager.show_dialogue_balloon(Dialogue_Resource,dialogueStart) #putting this here helps with player spamming interaction button
© www.soinside.com 2019 - 2024. All rights reserved.