mirror of
https://github.com/DerTyp7/harvestdale-unity.git
synced 2025-10-30 04:57:09 +01:00
add gruid buildingsystem
This commit is contained in:
25
Assets/Scripts/Building.cs
Normal file
25
Assets/Scripts/Building.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user