✨ Turret tile basis
This commit is contained in:
33
Scripts/Tiles/TurretTile.cs
Normal file
33
Scripts/Tiles/TurretTile.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Godot;
|
||||
|
||||
namespace AceFieldNewHorizon.Scripts.Tiles;
|
||||
|
||||
public partial class TurretTile : BaseTile
|
||||
{
|
||||
private Sprite2D _spriteBarrel;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_spriteBarrel = GetNodeOrNull<Sprite2D>("Barrel");
|
||||
}
|
||||
|
||||
public override void SetGhostMode(bool canPlace)
|
||||
{
|
||||
base.SetGhostMode(canPlace);
|
||||
|
||||
if (_spriteBarrel != null)
|
||||
_spriteBarrel.Modulate = canPlace
|
||||
? new Color(0, 1, 0, 0.5f)
|
||||
: new Color(1, 0, 0, 0.5f);
|
||||
}
|
||||
|
||||
public override void FinalizePlacement()
|
||||
{
|
||||
base.FinalizePlacement();
|
||||
|
||||
if (_spriteBarrel != null)
|
||||
_spriteBarrel.Modulate = Colors.White;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user