54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using Godot;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
public partial class Cell : TextureButton
|
|
{
|
|
public bool _isHovered = false, _isPressed = false, _isDisabled = false, _isFocused = false, _locked = false, _destroyed = false;
|
|
public int _address;
|
|
public Enemy _owner, _tenant;
|
|
public Actor _marker;
|
|
public Sprite2D _defaultMark;
|
|
public Board _board;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_defaultMark = GetNode<Sprite2D>("DefaultMark");
|
|
}
|
|
|
|
public override void _Pressed()
|
|
{
|
|
base._Pressed();
|
|
// GD.Print(_tenant.GetType().ToString() + " " + _tenant._number + " Pressed");
|
|
// GD.Print(_board._owner.GetType().ToString() + " " + _board._owner._number + " Pressed");
|
|
_owner.ClickCell(this);
|
|
}
|
|
|
|
public override void _Process(double DELTA)
|
|
{
|
|
base._Process(DELTA);
|
|
}
|
|
|
|
public void Disable(bool DISABLED)
|
|
{
|
|
SetProcess(!DISABLED);
|
|
}
|
|
|
|
public void Mark(Actor MARKER)
|
|
{
|
|
_marker = MARKER;
|
|
TextureNormal = MARKER._markNormal.Texture;
|
|
TexturePressed = MARKER._markPressed.Texture;
|
|
TextureHover = MARKER._markHovered.Texture;
|
|
TextureDisabled = MARKER._markDisabled.Texture;
|
|
TextureFocused = MARKER._markFocused.Texture;
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
_marker = null;
|
|
TextureNormal = TexturePressed = TextureHover = TextureDisabled = TextureFocused = _defaultMark.Texture;
|
|
}
|
|
}
|