33 lines
746 B
C#
33 lines
746 B
C#
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;
|
|
}
|
|
} |