potato mine not exploding fix
This commit is contained in:
parent
39082a9b87
commit
2987fc2604
2 changed files with 21 additions and 10 deletions
|
|
@ -5,24 +5,34 @@ namespace Newlon.Components.Plants.Behaviours;
|
|||
public partial class PotatomineBehaviour : BaseBehaviour
|
||||
{
|
||||
[Export] private Area2D _hitbox;
|
||||
[Export] private Area2D detectionBox;
|
||||
[Export] private CollisionShape2D _unprimedShape;
|
||||
[Export] private CollisionShape2D _primedShape;
|
||||
private bool _primed = false;
|
||||
public void Prime()
|
||||
{
|
||||
_tree.Set("parameters/Tree/conditions/primed",true);
|
||||
_tree.Set("parameters/Tree/conditions/primed", true);
|
||||
|
||||
_hitbox.Monitorable = false;
|
||||
|
||||
_primed = true;
|
||||
_unprimedShape.Disabled = true;
|
||||
_primedShape.Disabled = false;
|
||||
|
||||
if (detectionBox.HasOverlappingAreas())
|
||||
{
|
||||
SetupExplosion();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (_primed == false) return;
|
||||
_tree.Set("parameters/Tree/conditions/explode",true);
|
||||
SetupExplosion();
|
||||
}
|
||||
private void SetupExplosion()
|
||||
{
|
||||
_tree.Set("parameters/Tree/conditions/explode", true);
|
||||
_primed = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue