This commit is contained in:
Kirabsol 2025-01-28 13:20:31 +01:00
commit fd649c831c
3 changed files with 23 additions and 2 deletions

View file

@ -21578,6 +21578,10 @@ PrefabInstance:
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8643972435321148278, guid: 9afbe58abb2af8bb6b4ba51160a048a0, type: 3}
propertyPath: _isQueen
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8643972435321148278, guid: 9afbe58abb2af8bb6b4ba51160a048a0, type: 3}
propertyPath: <IsQueen>k__BackingField
value: 1

View file

@ -12,7 +12,20 @@ public abstract class AbstractUnit : MonoBehaviour
{
public float price;
[field: SerializeField] public bool IsTeamA { get; private set; }
[field: SerializeField] public bool IsQueen { get; set; }
[field: SerializeField]
protected bool _isQueen;
public virtual bool IsQueen
{
get => _isQueen;
set => SetQueen(value);
}
protected virtual void SetQueen(bool isQueen)
{
_isQueen = isQueen;
}
public abstract void TakeDamage(float damage);
public abstract void Heal(float heal);

View file

@ -19,7 +19,11 @@ public class MinecraftUnit : AbstractUnit
protected override void SetQueen(bool isQueen)
{
_isQueen = isQueen;
transform.Find("Crown").gameObject.SetActive(true);
}
new void Awake()
{