30 lines
484 B
C#
30 lines
484 B
C#
using Godot;
|
|
|
|
public partial class Level3 : Level
|
|
{
|
|
[Export]
|
|
public AnimationPlayer AnimationPlayer { get; set; }
|
|
[Export]
|
|
private int _numberOfHits = 10;
|
|
|
|
private MeshInstance3D _door;
|
|
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
_door = GetNode<MeshInstance3D>("Door");
|
|
}
|
|
|
|
private void OnDoorHit(Node3D node)
|
|
{
|
|
_numberOfHits--;
|
|
GD.Print(_numberOfHits);
|
|
AnimationPlayer.Play("HitFlash");
|
|
|
|
if (_numberOfHits == 0)
|
|
{
|
|
_door.QueueFree();
|
|
}
|
|
}
|
|
}
|