30 lines
777 B
C#
30 lines
777 B
C#
using Godot;
|
|
|
|
namespace AceFieldNewHorizon.Scripts.Tiles;
|
|
|
|
public partial class BaseTile : Node2D
|
|
{
|
|
protected CollisionShape2D CollisionShape;
|
|
protected Sprite2D Sprite;
|
|
|
|
public override void _Ready()
|
|
{
|
|
// Get references (optional: you can also Export and assign in editor)
|
|
CollisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
|
|
Sprite = GetNode<Sprite2D>("Sprite2D");
|
|
}
|
|
|
|
public void SetGhostMode(bool ghost)
|
|
{
|
|
if (CollisionShape != null)
|
|
CollisionShape.Disabled = ghost;
|
|
|
|
if (Sprite != null)
|
|
{
|
|
if (ghost)
|
|
Sprite.Modulate = new Color(1, 1, 1, 0.5f); // semi-transparent
|
|
else
|
|
Sprite.Modulate = Colors.White;
|
|
}
|
|
}
|
|
} |