public void SetAvailableQuestAsActive(int ID)
 {
     foreach (Quest q in _allQuests)
     {
         if (q.ID == ID)
         {
             if (_allQuests[ID] is EliminationQuest)
             {
                 EliminationQuest eq = ScriptableObject.CreateInstance <EliminationQuest>();
                 eq.AssignValuesFromCode(_allQuests[ID]);
                 _actualQuestPlayer.Add(eq);
                 eq.IsActiveNow    = true;
                 eq.IsAvailableNow = false;
                 _questPanel.UpdateStatusQuest(eq);
             }
             else if (_allQuests[ID] is CompletitionQuest)
             {
                 CompletitionQuest cq = ScriptableObject.CreateInstance <CompletitionQuest>();
                 cq.AssignValuesFromCode(_allQuests[ID]);
                 _actualQuestPlayer.Add(cq);
                 cq.IsActiveNow    = true;
                 cq.IsAvailableNow = false;
                 _questPanel.UpdateStatusQuest(cq);
             }
         }
     }
 }
        private void AssignQuestsFromSystemToPlayer(Quest[] quests)
        {
            _allQuests = new Quest[quests.Length];
            for (int i = 0; i < quests.Length; i++)
            {
                _allQuests[quests[i].ID] = quests[i];
            }
            for (int i = 0; i < _allQuests.Length; i++)
            {
                if (_allQuests[i].IsActiveNow)
                {
                    if (_allQuests[i] is EliminationQuest)
                    {
                        EliminationQuest eq = ScriptableObject.CreateInstance <EliminationQuest>();
                        eq.AssignValuesFromCode(_allQuests[i]);
                        _actualQuestPlayer.Add(eq);
                    }
                    else if (_allQuests[i] is CompletitionQuest)
                    {
                        CompletitionQuest cq = ScriptableObject.CreateInstance <CompletitionQuest>();
                        cq.AssignValuesFromCode(_allQuests[i]);
                        _actualQuestPlayer.Add(cq);
                    }
                }

                if (_allQuests[i].CompletedByUser)
                {
                    _questsCompleted++;
                }
            }
            _questUpdater = _questUpdatePanel.GetComponent <QuestUpdater>();
            _questPanel.SetAllQuest(_allQuests);
        }
 private void UpdateActualMissions(Quest q)
 {
     _endedActualQuestPlayer.Add(q);
     _actualQuestPlayer.Remove(q);
     if (q.NextMissionId >= 0)
     {
         Quest nextQuest = _allQuests[q.NextMissionId];
         Debug.Log("Siguiente: " + nextQuest.name);
         if (nextQuest is CompletitionQuest)
         {
             CompletitionQuest toAdd = ScriptableObject.CreateInstance <CompletitionQuest>();
             toAdd.AssignValuesFromCode(nextQuest);
             toAdd.IsAvailableNow = true;
             _actualQuestPlayer.Add(toAdd);
             _questPanel.UpdateStatusQuest(toAdd);
         }
         else if (nextQuest is EliminationQuest)
         {
             EliminationQuest toAdd = ScriptableObject.CreateInstance <EliminationQuest>();
             toAdd.AssignValuesFromCode(nextQuest);
             toAdd.IsAvailableNow = true;
             _actualQuestPlayer.Add(toAdd);
             _questPanel.UpdateStatusQuest(toAdd);
         }
     }
 }
 public void UpdateQuestPlayerData(List <int> missionsFromPlayer)
 {
     foreach (int i in missionsFromPlayer)
     {
         if (_allQuests[i].IsActiveNow)
         {
             if (_allQuests[i] is EliminationQuest)
             {
                 EliminationQuest eq = ScriptableObject.CreateInstance <EliminationQuest>();
                 eq.AssignValuesFromCode(_allQuests[i]);
                 _actualQuestPlayer.Add(eq);
             }
             else if (_allQuests[i] is CompletitionQuest)
             {
                 CompletitionQuest cq = ScriptableObject.CreateInstance <CompletitionQuest>();
                 cq.AssignValuesFromCode(_allQuests[i]);
                 _actualQuestPlayer.Add(cq);
             }
         }
     }
 }