Воскрешение доспехов при их смерти
This commit is contained in:
parent
4dbcb00029
commit
619ed0c88e
2 changed files with 6 additions and 9 deletions
|
@ -23,7 +23,6 @@ public partial class LivingArmor : CharacterBody2D
|
|||
|
||||
[Export] public SideFace Facing = SideFace.Down;
|
||||
[Export] public float MovingSpeed = 16f;
|
||||
[Export] public bool IsAlive = true;
|
||||
|
||||
public State CurrentState
|
||||
{
|
||||
|
@ -54,10 +53,12 @@ public partial class LivingArmor : CharacterBody2D
|
|||
private readonly List<Node2D> _bodiesInSight = new List<Node2D>();
|
||||
private readonly List<Node2D> _bodiesNearBy = new List<Node2D>();
|
||||
private Node2D _target = null;
|
||||
private Vector2 _respawnPosition;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_sprite = (AnimatedSprite2D)FindChild("AnimatedSprite2D");
|
||||
_respawnPosition = Position;
|
||||
CurrentState = State.Waiting;
|
||||
var animationName = "side_walk";
|
||||
switch (Facing)
|
||||
|
@ -85,8 +86,6 @@ public partial class LivingArmor : CharacterBody2D
|
|||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (!IsAlive)
|
||||
return;
|
||||
_timeSinceState += (float)delta;
|
||||
|
||||
switch (_state)
|
||||
|
@ -248,12 +247,10 @@ public partial class LivingArmor : CharacterBody2D
|
|||
|
||||
public void Kill(Node2D killer)
|
||||
{
|
||||
if (!IsAlive)
|
||||
return;
|
||||
GD.Print($"{this.Name} was killed by {killer.Name}");
|
||||
IsAlive = false;
|
||||
EmitSignal(SignalName.Killed);
|
||||
QueueFree(); // TODO
|
||||
Position = _respawnPosition;
|
||||
// QueueFree(); // TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue