implemented skill system according to designdocuments
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace NightclubArcadia.Skills
|
||||
{
|
||||
public sealed class CommentaryIdleTimer : MonoBehaviour
|
||||
{
|
||||
[SerializeField] DialogueRunner dialogueRunner;
|
||||
[SerializeField] string contextId = "Entrance_Queue";
|
||||
[SerializeField] float idleSeconds = 45f;
|
||||
|
||||
float _idleAccum;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (string.IsNullOrEmpty(contextId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialogueRunner != null && dialogueRunner.IsDialogueRunning)
|
||||
{
|
||||
_idleAccum = 0f;
|
||||
return;
|
||||
}
|
||||
|
||||
_idleAccum += Time.deltaTime;
|
||||
if (_idleAccum < idleSeconds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_idleAccum = 0f;
|
||||
|
||||
var runtime = SkillRuntime.Instance;
|
||||
if (runtime == null || runtime.Commentary == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
runtime.Commentary.RequestCommentary(contextId, repeatable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user