17 lines
457 B
C#
17 lines
457 B
C#
using Godot;
|
|
|
|
namespace Newlon.Components.Plants.Behaviours;
|
|
|
|
public partial class PeashooterBehaviour : Node
|
|
{
|
|
[Export] private AnimationTree _animationTree;
|
|
[Export] private Timer _shootTimer;
|
|
[Export] private Eyesight _sight;
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
bool readyToShoot = _sight.EnemyDetected && _shootTimer.TimeLeft <= 0;
|
|
|
|
_animationTree.Set("parameters/conditions/ready", readyToShoot);
|
|
}
|
|
}
|