public void BeginMission() { phase = MissionPhase.Active; foreach (var listener in GameObject.FindGameObjectsWithTag("MissionListener")) { listener.SendMessage("OnBeginMission", SendMessageOptions.DontRequireReceiver); } //assign quests for (int teamIt = 0; teamIt < mission.Teams.Length; ++teamIt) { var activeTeam = mission.Teams[teamIt]; var defTeam = mission.Definition.Teams[teamIt]; for (int slotIt = 0; slotIt < defTeam.Slots.Count; ++slotIt) { var slot = activeTeam.Slots[slotIt]; if (slot.Status != SlotStatus.Human) { continue; } var player = slot.SpawnedShip.GetComponent<PlayerShip>(); foreach (var quest in defTeam.Quests) { var playerQuest = Instantiate(quest); SpaceTraderConfig.QuestBoard.NewQuest(playerQuest); SpaceTraderConfig.QuestBoard.AcceptQuest(player, playerQuest); } } } }
internal void ContinueMission(int hits) { if (hits == 0) { _eliminatedCoords.Add(_lastTarget); if (_phase == MissionPhase.HitTargetEndPoint) { _endPoint = _targetHits.Last(); _lastTarget = _targetHits.First(); _strafingDirection = CalculateDirection(_endPoint, _lastTarget, _orientation); _phase = MissionPhase.DestroyTarget; } ProcessIntel(); } else { _targetHits.Add(_lastTarget); if (_targetHits.Count == 2) { _orientation = CalculateOrientation(_targetHits[0], _targetHits[1]); _strafingDirection = CalculateDirection(_targetHits[0], _targetHits[1], _orientation); _phase = MissionPhase.HitTargetEndPoint; } ProcessIntel(); } }
private void Awake() { SceneManager.activeSceneChanged += SceneChanged; phase = MissionPhase.Prep; var scene = SceneManager.GetActiveScene(); SceneChanged(scene, scene); }
public void EndMission() { phase = MissionPhase.Finished; foreach (var listener in GameObject.FindGameObjectsWithTag("MissionListener")) { listener.SendMessage("OnEndMission", SendMessageOptions.DontRequireReceiver); } }
internal void StartMission(Shot _lastShot) { _missionTarget = new Coordinate(_lastShot); _targetHits.Add(_missionTarget); _phase = MissionPhase.DetermineTargetOrientation; _eliminatedCoords.AddRange(_mothership.EliminatedCoords.Where(c => c.X == _missionTarget.X || c.Y == _missionTarget.Y)); ProcessIntel(); }