mirror of
https://github.com/DerTyp7/harvestdale-unity.git
synced 2025-10-29 12:52:07 +01:00
26 lines
511 B
C#
26 lines
511 B
C#
using UnityEngine;
|
|
|
|
public class Building : MonoBehaviour
|
|
{
|
|
public bool isPlaced = false;
|
|
public PlaceableObject placeableObject;
|
|
|
|
public void Place()
|
|
{
|
|
isPlaced = true;
|
|
BuildingManager.buildings.Add(this);
|
|
}
|
|
|
|
public void Demolish()
|
|
{
|
|
isPlaced = false;
|
|
BuildingManager.buildings.Remove(this);
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
public Vector3Int GetGridPosition()
|
|
{
|
|
return new Vector3Int(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y), 0);
|
|
}
|
|
}
|