Прогрессия 2
This commit is contained in:
parent
b793b79d39
commit
f37e2b5c4f
10 changed files with 67 additions and 18 deletions
|
@ -2,7 +2,7 @@ using Godot;
|
|||
using System;
|
||||
using Godot.Collections;
|
||||
|
||||
// [Tool]
|
||||
[Tool]
|
||||
public partial class NPC : Node2D
|
||||
{
|
||||
[Signal]
|
||||
|
@ -20,7 +20,7 @@ public partial class NPC : Node2D
|
|||
}
|
||||
|
||||
private AnimatedSprite2D _sprite;
|
||||
|
||||
private Interactable _interactable;
|
||||
private int _currentDialogLine;
|
||||
|
||||
//Диалог закончен, если больше нет строк диалога.
|
||||
|
@ -38,10 +38,21 @@ public partial class NPC : Node2D
|
|||
return IsDialogEnded ? DefaultDialogLine : DialogLines[_currentDialogLine++];
|
||||
}
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
_interactable.Disable();
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
_interactable.Enable();
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_sprite = (AnimatedSprite2D)FindChild("AnimatedSprite2D");
|
||||
_interactable = (Interactable)FindChild("Interactable");
|
||||
if (Frames is not null) _sprite.SpriteFrames = Frames;
|
||||
_sprite.Play("default");
|
||||
_currentDialogLine = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue