using System.Collections.Generic; using AsteroidGame.Entities.Structures.Scripts; using UnityEngine; namespace AsteroidGame.Handlers { public class BuildingHandler : MonoBehaviour { [Header("Assigned on start")] [SerializeField] ScoreHandler scoreHandler; [Header("Assigned on start")] [SerializeField] int buildingSelector = 0; //[Header("Prefabs")] [SerializeField] List buildings = new List(); // Start is called before the first frame update void Start() { scoreHandler = FindObjectOfType(); } public void BuildTower(GameObject _tileGO) { //Tile _tile = _tileGO.GetComponentInChildren(); //Debug.Log($"Placing tower on Tile: {_tileGO.transform.position}"); //Debug.Log($"Placing tower on Node: {_node.coordinates}"); // if (scoreHandler.CurrentBalance - buildings[buildingSelector].Cost < 0) // { // print("Insufficient Funds!"); // return; // } // else // { // scoreHandler.ModifyWealth(-buildings[buildingSelector].Cost); // Instantiate(buildings[buildingSelector], _tileGO.transform.position, Quaternion.identity, transform); // } } public Vector2Int GetVector2(GameObject _o) { return new Vector2Int((Mathf.RoundToInt(_o.transform.position.x) / 10), (Mathf.RoundToInt(_o.transform.position.z / 10))); } } }