private void purchase() { for (int i = 0; i < upgradeCostList.Length - 1; i++) { MetaScript.getRes().addResource(i, -upgradeCostList [i]); } }
protected void tryQuest() { if (myQuests.checkQuest()) { if (MetaScript.getRes().roomForResource(ResourceTypes.POPULATION, 1)) { Debug.Log("QUEST COMPLETED"); GetComponentInChildren <SpeechBubble>().setText("Quest Completed"); MetaScript.Poof(transform.position); TakeSoul(); } else { Debug.Log("Not enough population"); GetComponentInChildren <SpeechBubble>().setText("You require additional Pylons... I mean houses"); } } else { Debug.Log("Attempted quest but failed. Need " + myQuests.GetQuestGoal().getThreshold() + " of " + GetQuestType().Name ); gameObject.GetComponentInChildren <SpeechBubble>().setText("Need " + myQuests.GetQuestGoal().getThreshold() + " " + GetQuestType().Name); } }
// Use this for initialization void Start() { for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++) { MetaScript.getRes().increaseCapacity(i, maxAmount[i]); } }
public void purchase() { for (int i = 0; i < cost.Length; i++) { MetaScript.getRes().addResource(i, -cost [i]); } }
public void recieveAction() { for (int i = 0; i < amount.Length; i++) { MetaScript.getRes().addResource(i, amount[i]); } Destroy(gameObject); }
private void drop() { float resMult = MetaScript.getGlobal_Stats().getGatherMultiplier(); curRes = (int)((float)curRes * resMult); MetaScript.getRes().addResource(this.findingType, curRes); curRes = 0; }
public void recieveAction() { MetaScript.getRes().addResource(myType, 1); SendMessage("damage", 1); if (hasSound) { GetComponent <AudioSource> ().Play(); } }
private static bool takeRes(ResourceTypes i, int a) { if (hasRes(i, a)) { MetaScript.getRes().addResource(i, -a); return(true); } return(false); }
void Start() { textsValuesText = new Text[(int)ResourceTypes.NumberOfTypes]; for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++) { textsValuesText [i] = this.transform.GetChild(i).GetChild(0).gameObject.GetComponent <Text> (); } resourceManager = MetaScript.getRes(); updateResourcesUI(); }
public void updateHUD() { ResourceManager res = MetaScript.getRes(); UnityEngine.UI.Text resHUD = gameObject.GetComponentInChildren <UnityEngine.UI.Text>(); for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++) { resHUD.text = ((ResourceTypes)i).ToString() + ":" + res.getResource(i) + "\n"; } // resHUD.text="Wood: " + res.getResource(ResourceTypes.WOOD) // + "\nFood: " + res.getResource(ResourceTypes.FOOD); }
public bool canAfford() { for (int i = 0; i < cost.Length; i++) { if (MetaScript.getRes().hasResource(i, cost [i])) { // Do nothing } else { return(false); } } return(true); }
void Start() { starvingTickTimer = GameObject.Find("Calendar").GetComponent <GameTime>().dayTime; resourceManager = MetaScript.getRes(); allUIGameObjects = GameObject.Find("AllUIObjectsCanvas"); npcManagerGameObject = allUIGameObjects.transform.GetChild(0).GetChild(0).gameObject; setNPCList(MetaScript.GetNPC()); player = GameObject.FindGameObjectWithTag("Player"); buffSystem = new BuffSystem(); noFood = false; //StartCoroutine (starvingTimer (starvingTickTimer)); }
/// <summary> /// Removes a NPC from the List. /// </summary> /// <param name="aNPC">A NPC. </param> public void removeNPC(GameObject aNPC) { MetaScript.getRes().addResource(ResourceTypes.POPULATION, -1); NPCs.Remove(aNPC); if (UINPCManagerList.activeSelf == true) { AllUIObjectsCanvas.transform.GetChild(0).GetChild(0).gameObject.GetComponent <NPCManager> ().reloadMenu(); } if (UINPCMoreDetails.GetComponent <moreDetailsUIController> ().getCurrentNPC() == aNPC) { UINPCMoreDetails.transform.parent.gameObject.GetComponent <npcManagerUIController> ().closeMoreDetails(); } publish(); }
// Update is called once per frame void Update() { if (controls.keyDown(controls.TownPortal)) { bool inBuilding = false; if (buildingCheck != null) { inBuilding = buildingCheck.getPlayerInBuilding(); } if (MetaScript.getRes().hasResource(costType, resourceCost) && !inBuilding) { MetaScript.getRes().addResource(costType, -resourceCost); MetaScript.preTeleport(); transform.parent.transform.position = MetaScript.getTownCenter().transform.position + new Vector3(0.5f, 0, -0.5f); MetaScript.postTeleport(); MetaScript.Poof(MetaScript.getPlayer().transform.position); } } }
private void penguinInSheepsClothing(int choiceID) { GameObject sheep = GameObject.Find("PenguinInSheepsClothing"); switch (choiceID) { case 0: MetaScript.getRes().addResource(ResourceTypes.FOOD, 10); Destroy(sheep); break; case 1: Instantiate(enemy, sheep.transform.position, Quaternion.identity); Destroy(sheep); break; case 2: Instantiate(sheepMan, sheep.transform.position, Quaternion.identity); Destroy(sheep); break; } }
public void recieveAction() { canUpgrade = true; AllUIObjects.transform.GetChild(2).gameObject.SetActive(true); upgradePrompt.SetActive(true); nameText.text = upgrade.name.ToString(); string tempCostString = ""; for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++) { if (!MetaScript.getRes().hasResource(i, upgradeCostList [i])) { canUpgrade = false; } if (upgradeCostList [i] > 0) { tempCostString += ((ResourceTypes)i).ToString() + ": " + upgradeCostList [i].ToString() + "\n"; } } costText.text = tempCostString; moreResourcesRequiredText.text = ""; setListener(); }
/// <summary> /// Adds a NPC to the List. /// </summary> /// <param name="newNPC"> a NPC. </param> public void addNPC(GameObject newNPC) { MetaScript.getRes().addResource(ResourceTypes.POPULATION, 1); NPCs.Add(newNPC); publish(); }
private static bool hasRes(ResourceTypes i, int a) { return(MetaScript.getRes().hasResource(i, a)); }