public void UpgradeSomething() { //We need to Upgrade this but NOT kick the worker rodent off eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level++; UpdateState(); _DestroyMenu.showMenu(false, Vector3.zero, null, this); //StartCoroutine(BuildCoroutine()); }
public void ShowDestroyMenu(bool cond, Vector3 loc, GameObject go, BuildableObject building) { if (_DestroyMenu) { _DestroyMenu.showMenu(cond, loc, go, building); } }
//Absolute nonsense i have to do this otherwise the same click insta clicks a button on the menu opened IEnumerator ClickDelay(bool cond, UIBuildMenu menu) { yield return(new WaitForSeconds(0.05f)); // To-Do: update for touch // Debug.Log("Will need to get click location from somewhere for Mobile"); Vector3 Location = Input.mousePosition; menu.showMenu(cond, Location, this.transform.gameObject, this); }
// Called from MVC controller to Build or Upgrade a building public void BuildSomething(string type) { SoundManager.Instance.PlayConstruction(); // Debug.Log("Time to Build Something type=" + type); switch (type) { case ("house"): this.gameObject.AddComponent <bHouse>(); eType = BuildingType.House; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; // Debug.Log("Made a house"); break; case ("farm"): this.gameObject.AddComponent <bFarm>(); eType = BuildingType.Farm; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; // Debug.Log("Made a Farm"); break; case ("banner"): this.gameObject.AddComponent <bBanner>(); eType = BuildingType.Banner; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; // Debug.Log("Made a Banner"); break; case ("outpost"): this.gameObject.AddComponent <bOutpost>(); eType = BuildingType.Outpost; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; // Debug.Log("Made an Outpost"); break; case ("towncenter"): this.gameObject.AddComponent <bTownCenter>(); eType = BuildingType.TownCenter; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; // Debug.Log("Made a TownCenter"); break; case ("garbagecan"): this.gameObject.AddComponent <bGarbageCan>(); eType = BuildingType.GarbageCan; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; break; case ("woodpile"): this.gameObject.AddComponent <bWoodPile>(); eType = BuildingType.WoodPile; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; break; case ("stonepile"): this.gameObject.AddComponent <bStonePile>(); eType = BuildingType.StonePile; eState = BuildingState.Building; _sr.sprite = _sStateConstruction; _level = 1; break; case null: break; } UpdateState(); _BuildMenu.showMenu(false, Vector3.zero, null, this); if (_level == 1) { // print("Called increment Slots on" + this.gameObject); ResourceManagerScript.Instance.IncrementBuildingSlots(1); SetConstructionMax(5); // Might want to do every level to make building difficult } //StartCoroutine(BuildCoroutine()); // Old auto way }