// Use this for initialization
 void Start()
 {
     playerCurrentHealth = playerMaxHealth;
     quest        = FindObjectOfType <QuestScript>();
     playerSprite = GetComponent <SpriteRenderer>();
     looponce     = true;
 }
Beispiel #2
0
    public void AcceptQuest(Quest quest)
    {
        foreach (CollectObjective o in quest.CollectObjectives)
        {
            Backpack.MyInstance.itemCountChangedEvent += new ItemCountChanged(o.UpdateItemCount);
            o.UpdateItemCount();
        }

        foreach (KillObjective o in quest.MyKillObjectives)
        {
            Character.MyInstance.killConfirmedEvent += new KillConfirmed(o.UpdateKillCount);
        }

        quests.Add(quest);
        GameObject go = Instantiate(questPrefab, questParent);

        go.GetComponent <Text>().text = quest.MyTitle;

        QuestScript qs = go.GetComponent <QuestScript>();

        quest.MyQuestScript = qs;
        qs.MyQuest          = quest;
        questScripts.Add(qs); //so good

        CheckCompletion();
    }
Beispiel #3
0
    public void AcceptQuest(Quest quest)
    {
        if (currentCount < maxCount)
        {
            currentCount++;
            questCountTxt.text = currentCount + "/" + maxCount;
            foreach (CollectObjective o in quest.MyCollectObjectives)
            {
                InventoryScript.MyInstance.itemCountChangedEvent += new ItemCountChanged(o.UpdateItemCount);

                o.UpdateItemCount();
            }
            foreach (KillObjective o in quest.MyKillObjectives)
            {
                GameManager.MyInstance.killConfirmedEvent += new KillConfirmed(o.UpdateKillCount);
            }

            MyQuests.Add(quest);

            GameObject go = Instantiate(questPrefab, questParent);

            QuestScript qs = go.GetComponent <QuestScript>();
            quest.MyQuestScript = qs;
            qs.MyQuest          = quest;

            questScripts.Add(qs);

            go.GetComponent <Text>().text = quest.MyTitle;

            CheckCompletion();
        }
    }
Beispiel #4
0
    public void AcceptQuest(Quest quest)
    {
        foreach (CollectObjective o in quest.MyCollectObjectives)
        {
            InventoryScript.MyInstance.itemCountChangedEvent += o.UpdateItemCount;
            o.UpdateItemCount();
        }

        foreach (KillObjective o in quest.MyKillObjectives)
        {
            GameManager.MyInstance.killConfirmEvent += o.UpdateKillCount;
        }

        GameObject go = Instantiate(questPrefab, questParent);

        questObjects.Add(go);

        QuestScript qs = go.GetComponent <QuestScript>();

        quest.MyQuestScript = qs;
        qs.MyQuest          = quest;
        questScripts.Add(qs);

        go.GetComponentInChildren <Text>().text = quest.MyTitle;

        CheckCompletion();
    }
Beispiel #5
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
Beispiel #6
0
 void Awake()
 {
     health = FindObjectOfType <PlayerHealthManager>();
     exp    = FindObjectOfType <Experience>();
     quest  = FindObjectOfType <QuestScript>();
     DontDestroyOnLoad(gameObject);
     saveFile = this;
 }
Beispiel #7
0
 public void RemoveQuest(QuestScript qs)
 {
     questScripts.Remove(qs);
     Destroy(qs.gameObject);
     quests.Remove(qs.MyQuest);
     questDescription.text = string.Empty;
     selected = null;
     qs.MyQuest.MyQuestGiver.UpdateQuestStatus();
     qs = null;
 }
Beispiel #8
0
    public void AcceptQuest(Quest quest)
    {
        GameObject go = Instantiate(questPrefab, questParent);

        QuestScript qs = go.GetComponent <QuestScript>();

        quest.MyQuestScript = qs;
        qs.MyQuest          = quest;

        go.GetComponent <Text>().text = quest.MyTitle;
    }
    // Use this for initialization
    void Start()
    {
        exp   = FindObjectOfType <Experience>();
        Game  = FindObjectOfType <GameController>();
        Quest = FindObjectOfType <QuestScript>();


        if (Enemy == "")
        {
            Enemy = "Slime";
        }

        if (Enemy == "Slime")
        {
            SlimeCounter = 1;
        }

        if (Enemy == "Zombie")
        {
            ZombieCounter = 1;
        }
        if (Enemy == "Mummy")
        {
            MummyCounter = 1;
        }

        if (Enemy == "Spike")
        {
            BossCounter = 1;
        }


        if (experience == 0)
        {
            experience = 10;
        }

        if (Money_Min == 0)
        {
            Money_Min = 2;
        }
        if (Money_Max == 0)
        {
            Money_Max = 10;
        }


        CurrentHealth = MaxHealth;

        Quest.MaxZombie += ZombieCounter;
        Quest.MaxSlimes += SlimeCounter;
        Quest.MaxBoss   += BossCounter;
        Quest.MaxMummy  += MummyCounter;
    }
Beispiel #10
0
    public void CreateQuest(Quests quest)
    {
        GameObject  gameObject  = Instantiate(questPrefab, questParent);
        QuestScript questScript = gameObject.GetComponentInChildren <QuestScript>();

        // Assign reference to questscript
        quest.QuestScript = questScript;
        questScript.Quest = quest;
        questScripts.Add(questScript);

        gameObject.GetComponentInChildren <Text>().text = quest.Name;
    }
Beispiel #11
0
 public void RemoveQuest(QuestScript qs)
 {
     questScripts.Remove(qs);
     Destroy(qs.gameObject);
     MyQuests.Remove(qs.MyQuest);
     questDescription.text = string.Empty;
     selected = null; //Deselectring the quest
     currentCount--;
     questCountTxt.text = currentCount + "/" + maxCount;
     qs.MyQuest.MyQuestGiver.UpdateQuestStatus();
     qs = null;
 }
Beispiel #12
0
    public void AcceptQuest(Quest quest)
    {
        foreach (CollectObjective co in quest.MyCollectObjectives)
        {
            InventotyScript.MyInstance.itemCountChangedEvent += new ItemCountChanged(co.UpdateItemCount);
        }

        GameObject  o  = Instantiate(questPrefab, questParent);
        QuestScript qs = o.GetComponent <QuestScript>();

        quest.MyQuestScrit      = qs;
        qs.MyQuest              = quest;
        qs.MyQuest.MyQuestScrit = qs;

        o.GetComponent <Text>().text = quest.MyTitle;
        questScripts.Add(qs);
    }
Beispiel #13
0
 public void ChangeScript(ScriptBase pScript)
 {
     if (pScript is NpcScript npc)
     {
         NpcScript?.Dispose();
         QuestScript?.Dispose();
         NpcScript = npc;
     }
     else if (pScript is QuestScript quest)
     {
         QuestScript?.Dispose();
         QuestScript = quest;
     }
     else
     {
         throw new ScriptException("Trying to pass a ScriptBase object that isn't handled.");
     }
 }
Beispiel #14
0
    public void RemoveQuest(QuestScript questScript)
    {
        if (questScript != null)
        {
            questScripts.Remove(questScript);
            Destroy(questScript.gameObject);
            Destroy(questScript.transform.parent.gameObject);

            //sessionData.Quests.Remove(questScript.Quest);
            questDescriptionText.text = string.Empty;
            selected = null;
            if (questScript.Quest.QuestGiver != null)
            {
                questScript.Quest.QuestGiver.UpdateQuestStatus();
            }
            questScript = null;
        }
    }
 // Use this for initialization
 void Start()
 {
     Quest = FindObjectOfType <QuestScript>();
 }
Beispiel #16
0
 /// <summary>
 /// Adds quest script.
 /// </summary>
 /// <param name="script"></param>
 public void AddQuestScript(QuestScript script)
 {
     _questScripts[script.Id] = script;
 }
    public void AcceptQuest(QuestScript quest)
    {
        GameObject go = Instantiate(questPrefab, questParent);

        //go.GetComponent<Text>().text = quest.MyTitle;
    }