Example #1
0
 public void MissionFinished(Mission mission)
 {
     finishedMissionsNumber++;
     GlobalOptions.GetPlayerScript().Yahoo();
     SetMissionFinished(mission.GetId());
     currentMissions.Remove(mission);
     if (currentMissions.Count == 0)
     {
         NotifyNoMissions();
     }
     thisLifeFinishedMissions.Add(mission);
     CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
     CurrentMissionsSerializer.RemoveMissionData(mission);
     timeOutTime = Time.time + GetTimeOut();
 }
Example #2
0
 public virtual void EmmitMissions(bool force = false)
 {
     if (!force && (GlobalOptions.gameState != GameStates.GAME || IsTimeOut()))
     {
         return;
     }
     if (currentMissions.Count == 0)          //инициализируем текущую
     {
         Mission currentMission = GetOneMissionObject();
         if (currentMission != null)
         {
             NotifyHasMissions();
             currentMissions.Add(currentMission);
         }
         CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
     }
 }
Example #3
0
 private void TryToGetNextFromEmmitted(bool force = false)
 {
     if (!force && (GlobalOptions.gameState != GameStates.GAME || IsTimeOut()))
     {
         return;
     }
     if (currentMissions.Count == 0)      //инициализируем текущую
     {
         if (emmittedMissionsPrefabs.Count > 0)
         {
             Mission missionPrefab  = (Mission)emmittedMissionsPrefabs [0];
             Mission currentMission = InstantiateMission(missionPrefab);
             emmittedMissionsPrefabs.RemoveAt(0);
             currentMissions.Add(currentMission);
             CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);                         //save
             CurrentMissionsSerializer.SaveCurrentMissions(emmittedMissionsPrefabs, misionEmmittedTag);
         }
     }
 }
Example #4
0
    public void EmmitMissions(bool force = false)
    {
        TryToGetNextFromEmmitted();

        if (force || canEmmitMissions())
        {
            Mission currentMission = null;
            TryToGetNextFromEmmitted(true);
            if (currentMissions.Count == 0)          //инициализируем текущую
            {
                currentMission = GetOneMissionObject();
                if (currentMission != null)
                {
                    NotifyHasMissions();
                    currentMissions.Add(currentMission);
                }
                CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
            }
            //emmitted
            int numberOfBoughtSlots = NumberOfBoughtSlots();
            if (emmittedMissionsPrefabs.Count < numberOfBoughtSlots - 1)
            {
                for (int i = emmittedMissionsPrefabs.Count; i < numberOfBoughtSlots - 1; i++)
                {
                    if (availableMissionsPrefabs.Count > 0)
                    {
                        Mission missionPrefab = (Mission)availableMissionsPrefabs [0];
                        availableMissionsPrefabs.Remove(missionPrefab);
                        emmittedMissionsPrefabs.Add(missionPrefab);
                    }
                }
                CurrentMissionsSerializer.SaveCurrentMissions(emmittedMissionsPrefabs, misionEmmittedTag);
            }
            lastMissionEmmitTime = GlobalOptions.GetLongFromDateTime(System.DateTime.UtcNow);
            MissionsUpdated();
        }
    }
Example #5
0
 public override void EmmitMissions(bool force = false)
 {
     if (!PersonInfo.tutorial)
     {
         return;
     }
     if (!force && (GlobalOptions.gameState != GameStates.GAME || IsTimeOut()))
     {
         return;
     }
     if (currentMissions.Count == 0)          //инициализируем текущую
     {
         Mission currentMission = GetOneMissionObject();
         if (currentMission != null)
         {
             currentMissions.Add(currentMission);
         }
         else
         {
             PersonInfo.FinishTutorial();
         }
         CurrentMissionsSerializer.SaveCurrentMissions(currentMissions, misionCurrentTag);
     }
 }