public void buildCastle(Village v) { int vWood = v.getWood (); VillageType vType = v.getMyType (); VillageActionType vAction = v.getAction (); if (vType != VillageType.Fort) { gameGUI.displayError (@"Upgrade to a Fort before building a Castle"); } else if (vWood < 12) { gameGUI.displayError (@"Castles require more lumber (12)"); } else if (vAction != VillageActionType.ReadyForOrders) { gameGUI.displayError (@"You cant queue build orders :/"); } else { v.setAction(VillageActionType.StartedUpgrading); v.addWood (-12); } }
public void upgradeVillage(Village v) { int vWood = v.getWood (); VillageType vType = v.getMyType (); VillageActionType vAction = v.getAction (); if (vType == VillageType.Fort) { gameGUI.displayError(@"The only structure stronger than a Fort is a Castle. ¯\(°_o)/¯ Press Build Castle to go to the next level!"); } else if ((vType != VillageType.Fort) && (vWood >= 8) && (vAction == VillageActionType.ReadyForOrders)) { //v.setAction (VillageActionType.StartedUpgrading); v.networkView.RPC ("setVillageActionNet",RPCMode.AllBuffered,(int)VillageActionType.StartedUpgrading); //v.addWood(-8); v.networkView.RPC("addWoodNet",RPCMode.AllBuffered,-8); } }
public void updateVillageActions(Village v) { VillageActionType action = v.getAction (); if (action == VillageActionType.StartedUpgrading) { v.gameObject.networkView.RPC ("setVillageActionNet",RPCMode.AllBuffered,(int)VillageActionType.FinishedUpgrading); } else if (action == VillageActionType.FinishedUpgrading) { v.gameObject.networkView.RPC ("setVillageActionNet",RPCMode.AllBuffered,(int)VillageActionType.ReadyForOrders); VillageType vType = v.getMyType(); if (vType == VillageType.Hovel) { v.gameObject.networkView.RPC ("switchPrefabNet",RPCMode.AllBuffered,(int)VillageType.Town); v.gameObject.networkView.RPC ("setVillageTypeNet",RPCMode.AllBuffered,(int)VillageType.Town); v.gameObject.networkView.RPC ("setHealthNet",RPCMode.AllBuffered,2); } else if (vType == VillageType.Town) { v.gameObject.networkView.RPC ("switchPrefabNet",RPCMode.AllBuffered,(int)VillageType.Fort); v.gameObject.networkView.RPC ("setVillageTypeNet",RPCMode.AllBuffered,(int)VillageType.Fort); v.gameObject.networkView.RPC ("setHealthNet",RPCMode.AllBuffered,5); } else if (vType == VillageType.Fort) { v.gameObject.networkView.RPC ("switchPrefabNet",RPCMode.AllBuffered,(int)VillageType.Castle); v.gameObject.networkView.RPC ("setVillageTypeNet",RPCMode.AllBuffered,(int)VillageType.Castle); v.gameObject.networkView.RPC ("setHealthNet",RPCMode.AllBuffered,10); v.gameObject.networkView.RPC ("setWageNet",RPCMode.AllBuffered,80); } } }