Esempio n. 1
0
 private void purchase()
 {
     for (int i = 0; i < upgradeCostList.Length - 1; i++)
     {
         MetaScript.getRes().addResource(i, -upgradeCostList [i]);
     }
 }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++)
     {
         MetaScript.getRes().increaseCapacity(i, maxAmount[i]);
     }
 }
Esempio n. 4
0
 public void purchase()
 {
     for (int i = 0; i < cost.Length; i++)
     {
         MetaScript.getRes().addResource(i, -cost [i]);
     }
 }
Esempio n. 5
0
 public void recieveAction()
 {
     for (int i = 0; i < amount.Length; i++)
     {
         MetaScript.getRes().addResource(i, amount[i]);
     }
     Destroy(gameObject);
 }
Esempio n. 6
0
    private void drop()
    {
        float resMult = MetaScript.getGlobal_Stats().getGatherMultiplier();

        curRes = (int)((float)curRes * resMult);
        MetaScript.getRes().addResource(this.findingType, curRes);
        curRes = 0;
    }
Esempio n. 7
0
 public void recieveAction()
 {
     MetaScript.getRes().addResource(myType, 1);
     SendMessage("damage", 1);
     if (hasSound)
     {
         GetComponent <AudioSource> ().Play();
     }
 }
Esempio n. 8
0
 private static bool takeRes(ResourceTypes i, int a)
 {
     if (hasRes(i, a))
     {
         MetaScript.getRes().addResource(i, -a);
         return(true);
     }
     return(false);
 }
Esempio n. 9
0
 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();
 }
Esempio n. 10
0
    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);
    }
Esempio n. 11
0
 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);
 }
Esempio n. 12
0
    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));
    }
Esempio n. 13
0
    /// <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();
    }
Esempio n. 14
0
    // 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);
            }
        }
    }
Esempio n. 15
0
    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;
        }
    }
Esempio n. 16
0
    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();
    }
Esempio n. 17
0
 /// <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();
 }
Esempio n. 18
0
 private static bool hasRes(ResourceTypes i, int a)
 {
     return(MetaScript.getRes().hasResource(i, a));
 }