67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using Godot;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
public partial class Shield : TextureButton
|
|
{
|
|
public bool _isHovered = false, _isPressed = false, _isDisabled = false, _isFocused = false, _locked = false, _destroyed = false, _broken = false;
|
|
public int _address, _durability;
|
|
public Enemy _owner, _tenant;
|
|
public Actor _marker;
|
|
public Sprite2D _regularMark, _brokenMark;
|
|
public Board _board;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_regularMark = GetNode<Sprite2D>("RegularMark");
|
|
_brokenMark = GetNode<Sprite2D>("BrokenMark");
|
|
_durability = 100;
|
|
}
|
|
|
|
public override void _Pressed()
|
|
{
|
|
base._Pressed();
|
|
_owner.ClickShield(this);
|
|
}
|
|
|
|
public override void _Process(double DELTA)
|
|
{
|
|
base._Process(DELTA);
|
|
}
|
|
|
|
public void Break()
|
|
{
|
|
_broken = true;
|
|
TextureNormal = TexturePressed = TextureHover = TextureDisabled = TextureFocused = _brokenMark.Texture;
|
|
}
|
|
|
|
public void ChangeHealth(int CHANGE_AMOUNT)
|
|
{
|
|
_durability += CHANGE_AMOUNT;
|
|
if (!_broken)
|
|
{
|
|
if (_durability <= 0)
|
|
{
|
|
Break();
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
// }
|
|
|
|
}
|