Can now destroy buildings
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
using UnityEngine;
|
||||
using PashaBibko.Pacore.Attributes;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine.Scripting;
|
||||
using Fruitomation.Global;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.Game
|
||||
{
|
||||
@@ -7,7 +11,21 @@ namespace Fruitomation.Game
|
||||
[Header("Building Properties")]
|
||||
[SerializeField] private Sprite BuildingSprite;
|
||||
[field: SerializeField] public Vector2Int SizeOnGrid { get; private set; }
|
||||
|
||||
private BuildingManager Manager;
|
||||
|
||||
public void SetManager(BuildingManager manager) => Manager = manager;
|
||||
|
||||
[UsedImplicitly, Preserve, InspectorCallable("Click Building")] public void OnBuildingClicked()
|
||||
{
|
||||
Debug.Log($"Building clicked {gameObject.name}");
|
||||
if (GameStateController.Is(GameState.Editing))
|
||||
{
|
||||
Manager.RemoveBuilding(this);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public Sprite Sprite => BuildingSprite;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user