Added chuga dialog to fight scene
This commit is contained in:
@@ -4,13 +4,13 @@ namespace Babushka.scripts.CSharp.Common.NPC;
|
||||
|
||||
public partial class TalkingCharacter : Node2D
|
||||
{
|
||||
[Export] private AnimatedSprite2D _sprite;
|
||||
[Export] private AnimatedSprite2D? _sprite;
|
||||
[Export] private string[] _timelinesToPlay;
|
||||
|
||||
|
||||
|
||||
|
||||
private bool _isTalking = true;
|
||||
private int _timelineIndex = 0;
|
||||
|
||||
|
||||
[Signal] public delegate void TalkingEventHandler(string timelineName);
|
||||
|
||||
public override void _Ready()
|
||||
@@ -22,16 +22,19 @@ public partial class TalkingCharacter : Node2D
|
||||
{
|
||||
if (_isTalking || _timelineIndex >= _timelinesToPlay.Length)
|
||||
{
|
||||
_sprite.Animation = "idle";
|
||||
if (_sprite != null)
|
||||
_sprite.Animation = "idle";
|
||||
_isTalking = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sprite.Animation = "talk";
|
||||
if (_sprite != null)
|
||||
_sprite.Animation = "talk";
|
||||
_isTalking = true;
|
||||
EmitSignal(SignalName.Talking, _timelinesToPlay[_timelineIndex]);
|
||||
_timelineIndex++;
|
||||
}
|
||||
_sprite.Play();
|
||||
if (_sprite != null)
|
||||
_sprite.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user