22 lines
560 B
C#
22 lines
560 B
C#
using Godot;
|
|
|
|
namespace Newlon.Components.Plants.Behaviours;
|
|
|
|
public partial class PeashooterBehaviour : Node
|
|
{
|
|
[Export] private AnimationPlayer _player;
|
|
[Export] private Timer _shootTimer;
|
|
[Export] private Eyesight _sight;
|
|
[Export] private string _libName;
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
bool readyToShoot = _sight.EnemyDetected && _shootTimer.TimeLeft <= 0;
|
|
|
|
if(readyToShoot)
|
|
{
|
|
_player.Play(_libName+"/shoot");
|
|
_player.Queue(_libName+"/idle");
|
|
}
|
|
}
|
|
}
|