private IEnumerator CreateNewBuilding_Coroutine(string typeBuilding, Transform building) { yield return(new WaitForSeconds(.1f)); if (building == null) { yield break; } switch (typeBuilding.ToLower()) { case "houses": building.GetComponent <Houses>().BuildNow = false; building.GetComponent <Houses>().ActiveTimeBuilding(); RemoveMoneyUser(building.GetComponent <Houses>().valueBuildidng); FxNewBuilding(); break; case "factory": building.GetComponent <Factory>().BuildNow = false; building.GetComponent <Factory>().ActiveTimeBuilding(); RemoveMoneyUser(building.GetComponent <Factory>().valueBuildidng); FxNewBuilding(); break; case "mall": building.GetComponent <Mall>().BuildNow = false; building.GetComponent <Mall>().ActiveTimeBuilding(); RemoveMoneyUser(building.GetComponent <Mall>().valueBuildidng); FxNewBuilding(); break; case "park": building.GetComponent <Park>().BuildNow = false; building.GetComponent <Park>().ActiveTimeBuilding(); RemoveMoneyUser(building.GetComponent <Park>().valueBuildidng); FxNewBuilding(); break; case "farm": building.GetComponent <Farm>().BuildNow = false; building.GetComponent <Farm>().ActiveTimeBuilding(); RemoveMoneyUser(building.GetComponent <Farm>().valueBuildidng); FxNewBuilding(); break; default: Debug.LogError("building not found"); break; } DataSave.SaveAll(); }
public void OnButtonExitClicked() { m_FxClick.Play(); DataSave.SaveAll(); Application.Quit(); }