Turret tile basis

This commit is contained in:
2025-08-30 12:03:26 +08:00
parent 32f96d488d
commit 1c6c03cd41
12 changed files with 155 additions and 4 deletions

View 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;
}
}