Ejemplo n.º 1
0
    /// <summary>
    /// This method is called when the QuestComponent reacts to a callback event with the type CollectCow.
    /// This method will as a response create a callback that increases progress for a escort quest
    /// </summary>
    /// <param name="eventInfo">CollectCowEventInfo;</param>
    private static void CollectCow(EventInfo eventInfo)
    {
        collectedCows++;
        //Debug.Log("Ko är lämnad");
        ProgressQuestEventInfo pqei = new ProgressQuestEventInfo {
            type = GoalType.Escort
        };

        EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.ProgressQuest, pqei);
    }
Ejemplo n.º 2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.M))
     {
         ProgressQuestEventInfo pqei = new ProgressQuestEventInfo {
             type = GoalType.Gather
         };
         EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.ProgressQuest, pqei);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Activates <see cref="PlayerStateMashine.AddItem(string, GameObject)"/> if the player enters the trigger zone
 /// </summary>
 /// <param name="other"></param>
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         ProgressQuestEventInfo pqei = new ProgressQuestEventInfo {
             type = GoalType.Find
         };
         EventHandeler.Current.FireEvent(EventHandeler.EVENT_TYPE.ProgressQuest, pqei);
         other.GetComponent <PlayerStateMashine>().AddItem(itemType, gameObject);
     }
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Called when the QuestComponent is reacting to a callback event that grats progress to a questType;
    /// It creates a new temporary list with all the quests that has the same questType;
    /// Reason for that is if a quest is completed during the process it will remove itself from the questlog list. Removal during runtime is not wanted so a new temporary list it is.
    /// Then it loops through the new list and calling its progress;
    /// </summary>
    /// <param name="eventInfo">ProgressQuestEventInfo;</param>
    private static void QuestProgress(EventInfo eventInfo)
    {
        ProgressQuestEventInfo pqei          = (ProgressQuestEventInfo)eventInfo;
        List <Quest>           tempQuestList = new List <Quest>();

        foreach (Quest q in questLog.Values)
        {
            if (q.QuestType.TypeOfGoal == pqei.type)
            {
                tempQuestList.Add(q);
            }
        }
        foreach (Quest qst in tempQuestList)
        {
            qst.IncreaseQuestProgress();
        }
    }