newlon/scripts/components/plants/behaviours/PeashooterBehaviour.cs

16 lines
423 B
C#

using Godot;
using System;
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);
}
}