Files
tictactoe/Gameplay/Cell.cs

47 lines
1.3 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();
_owner.ClickCell(this);
}
public override void _Process(double DELTA)
{
base._Process(DELTA);
}
public void Disable(bool DISABLED)
{
SetProcess(!DISABLED);
}
public void Mark(Actor MARKER = null)
{
_marker = MARKER;
TextureNormal = (MARKER == null ? _defaultMark : MARKER._markNormal).Texture;
TexturePressed = (MARKER == null ? _defaultMark : MARKER._markPressed).Texture;
TextureHover = (MARKER == null ? _defaultMark : MARKER._markHovered).Texture;
TextureDisabled = (MARKER == null ? _defaultMark : MARKER._markDisabled).Texture;
TextureFocused = (MARKER == null ? _defaultMark : MARKER._markFocused).Texture;
}
}