Exemple #1
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);
        }
    }
Exemple #2
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);
            }
        }
    }