/// <summary> /// Refreshes all open missions. /// </summary> public void RefreshOpenMissions() { if (this._level.GetState() != 4) { LogicClientAvatar playerAvatar = this._level.GetPlayerAvatar(); LogicDataTable missionTable = LogicDataTables.GetTable(20); for (int i = 0; i < missionTable.GetItemCount(); i++) { LogicMissionData missionData = (LogicMissionData)missionTable.GetItemAt(i); if (missionData.IsOpenForAvatar(playerAvatar)) { int index = -1; for (int j = 0; j < this._openMissions.Count; j++) { if (this._openMissions[j].GetMissionData() == missionData) { index = j; break; } } if (index == -1) { LogicMission mission = new LogicMission(missionData, this._level); mission.RefreshProgress(); this._openMissions.Add(mission); } } } } }
/// <summary> /// Ticks this instance. /// </summary> public void Tick() { bool refresh = false; for (int i = 0; i < this._openMissions.Count; i++) { LogicMission mission = this._openMissions[i]; if (mission != null) { mission.RefreshProgress(); if (mission.IsFinished()) { mission.Destruct(); this._openMissions.Remove(i--); refresh = true; } else { mission.Tick(); } } } if (refresh) { this.RefreshOpenMissions(); } }