//init Construction function public static Construction initConstruction(Vector3 pos, GameTypes.BuildingType bt, Town town) { Construction constro = GameObject.Instantiate(getConstruction("Construction"), town.gameObject.transform).GetComponent <Construction>(); constro.gameObject.transform.position = pos; constro.mType = bt; town.addEntity("constructions", constro); return(constro); }
//init building functions public static Building initBuilding(Vector3 pos, GameTypes.BuildingType bt, Town town) { Building b = GameObject.Instantiate(getBuilding(bt.ToString()), town.gameObject.transform).GetComponent <Building>(); b.gameObject.transform.position = pos; b.mType = bt; town.addEntity("buildings", b); return(b); }
public Building getBuildingOfType(GameTypes.BuildingType type) { Building res = null; foreach (Building b in mGroupMap["buildings"]) { if (b.mType == type) { return(b); } } return(null); }
public void listOutcome() { //get the chosen string int index = mListDropdown.value; if (index == 0) { return; } string choice = mListOptStrings[index]; switch (choice) { case "": setActive(false); return; case "Cancel": setActive(false); return; default: break; } //get the type from the string GameTypes.BuildingType type = (GameTypes.BuildingType)System.Enum.Parse(typeof(GameTypes.BuildingType), choice); if (type == 0) { Debug.LogError(string.Format("Choice type {0} not recognised", choice)); } //make the new action and anything it needs switch (mOutcomeString) { case "Construct": Construction c = ObjectManager.initConstruction(mHitPoint, type, mSelection.mTown); Construct constr = ObjectManager.initConstruct(mSelection.transform); constr.setTarget(c); mOutcomeAction = constr; break; default: Debug.LogError("Action choice not recognised"); break; } //mListDropdown.RefreshShownValue(); mOutcome = true; }