public MissionScript(string MissionName, int MissionDifficulty, MissionType TypeOfMission, float MissionTimeRequired) { name = MissionName; difficulty = MissionDifficulty; missionType = TypeOfMission; TimeReq = MissionTimeRequired; TimeRemaining = TimeReq; expReward = difficulty * Random.Range(9,24); moneyReward = (difficulty * Random.Range(99, 249)) + Random.Range(0, 99); missionState = MissionState.inactive; }
public void Play(Sprite player, int iLevel) { m_CurrMissionState = MissionState.Playing; m_MapComponent.LoadMap(Utility.strMapPath, iLevel); spriteManager.Player = player; spriteManager.InitEnemies(iLevel); spriteManager.InitExplosions(); spriteManager.InitBonus(); }
public override void Update(GameTime gameTime) { m_CurrMissionState = MissionState.Playing; m_MapComponent.Update(gameTime); spriteManager.Update(gameTime); if (spriteManager.AllEnemiesDied) m_CurrMissionState = MissionState.Completed; UserControlledSprite player = spriteManager.Player as UserControlledSprite; if (player.TotalLives < 0) m_CurrMissionState = MissionState.Fail; base.Update(gameTime); }
public void setState(MissionState state) { missionState = state; switch (missionState) { case MissionState.KillEnemies: inMissionReadoutLabel1.Display("Mission Status"); if (enemies.Count > 1) inMissionReadout1.Display("There are " + enemies.Count + " enemies remaining in this wave"); if(enemies.Count == 1) inMissionReadout1.Display("There is 1 enemy remaining in this wave"); if(enemies.Count == 0) inMissionReadout1.Display("New wave incoming!"); setSecondaryInfo(state); break; case MissionState.EscortShip: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Escort the ship to its target"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.ShipProgress: inMissionReadoutLabel1.Display("Progress:"); inMissionReadout1.Display(Mathf.RoundToInt((npc.objectiveController.progress / currentMission.progressTargetEscort) * 100) + "%"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.GoToExit: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Escort the ship to its jump point"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.LocateSpaceStation: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Locate the enemy space station"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.DefeatSpaceStation: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Destroy the space station"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.LocatePlanet: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Locate the vulnerable planet"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.DefendPlanet: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Defend for " + Mathf.RoundToInt(currentMission.defendTime - planetObjective.progress) + " seconds"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.LocateBoss: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Locate the enemy capital ship"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; case MissionState.DefeatBoss: inMissionReadoutLabel1.Display("Current Objective:"); inMissionReadout1.Display("Destroy the enemy capital ship"); inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); break; } }
public void setSecondaryInfo(MissionState state) { inMissionReadoutLabel2.Display(""); inMissionReadout2.Display(""); switch (state) { case MissionState.KillEnemies: inMissionReadoutLabel2.Display("Remaining Waves:"); if ((currentMission.numberOfWaves - currentMission.currentWave +1) > 0) inMissionReadout2.Display(currentMission.numberOfWaves - currentMission.currentWave + 2 + " waves remaining"); else inMissionReadout2.Display("Last wave"); break; case MissionState.DefendPlanet: if (planetObjective == null) planetObjective = FindObjectOfType<DefendThePlanetObjective>(); inMissionReadoutLabel2.Display("WARNING!:"); inMissionReadout2.Display("PLANET IS IN DANGER OF FALLING!"); break; } }
bool CreateEntry(HistoryEntry he, out string rewardcol) { rewardcol = ""; MissionState ml = current.MissionKey != null && he.MissionList.Missions.ContainsKey(current.MissionKey) ? he.MissionList.Missions[current.MissionKey] : null; if (ml != null && ((he.EntryType == JournalTypeEnum.MissionAccepted && (he.journalEntry as EliteDangerousCore.JournalEvents.JournalMissionAccepted).MissionId == ml.Mission.MissionId) || (he.EntryType == JournalTypeEnum.MissionCompleted && (he.journalEntry as EliteDangerousCore.JournalEvents.JournalMissionCompleted).MissionId == ml.Mission.MissionId) || (he.EntryType == JournalTypeEnum.MissionRedirected && (he.journalEntry as EliteDangerousCore.JournalEvents.JournalMissionRedirected).MissionId == ml.Mission.MissionId) )) { } else if (he.EntryType == JournalTypeEnum.Bounty) { var c = he.journalEntry as EliteDangerousCore.JournalEvents.JournalBounty; rewardcol = c.TotalReward.ToString("N0"); total_reward += c.TotalReward; total_kills++; balance += c.TotalReward; if (current.TargetFaction != null && current.TargetFaction.Equals(c.VictimFaction)) { faction_reward += c.TotalReward; faction_kills++; } } else if (he.EntryType == JournalTypeEnum.CommitCrime) { var c = he.journalEntry as EliteDangerousCore.JournalEvents.JournalCommitCrime; rewardcol = (-c.Cost).ToString("N0"); balance -= c.Cost; total_crimes++; } else if (he.EntryType == JournalTypeEnum.FactionKillBond) { var c = he.journalEntry as EliteDangerousCore.JournalEvents.JournalFactionKillBond; rewardcol = c.Reward.ToString("N0"); total_reward += c.Reward; total_kills++; balance += c.Reward; if (current.TargetFaction != null && current.TargetFaction.Equals(c.VictimFaction)) { faction_reward += c.Reward; faction_kills++; } } else if (he.EntryType == JournalTypeEnum.CapShipBond) { var c = he.journalEntry as EliteDangerousCore.JournalEvents.JournalCapShipBond; rewardcol = c.Reward.ToString("N0"); total_reward += c.Reward; total_kills++; balance += c.Reward; if (current.TargetFaction != null && current.TargetFaction.Equals(c.VictimFaction)) { faction_reward += c.Reward; faction_kills++; } } else if (he.EntryType == JournalTypeEnum.Resurrect) { var c = he.journalEntry as EliteDangerousCore.JournalEvents.JournalResurrect; rewardcol = (-c.Cost).ToString("N0"); balance -= c.Cost; } else if (jtelist.Contains(he.EntryType)) { } else { return(false); } return(true); }
void Awake() { int id = TransportGOController.Instance.SelectedMissionID; Debug.Log("Mission " + id + " loading..."); int count = 0; while (TransportGOController.Instance.Missions[id].Targets[count].ID!=-1) count++; States = new MissionState[count + 2]; States [0] = new MissionState(); States [0].Type = MissionStateType.Takeoff; States [0].Target = DataStorageController.GetMissionObjectByID(DataStorageController.Instance.MissionRunwaysID [0].ID) ; States [0].MissionStateText = "Take off from runway"; for (int i=1; i<States.Length - 1; i++) { States[i] = new MissionState(); States[i].Type = MissionStateType.Destroy; MissionObjectData data = TransportGOController.Instance.Missions[id].Targets[i - 1]; States[i].Target = DataStorageController.GetMissionObjectByID(data.ID); States[i].MissionStateText = TransportGOController.Instance.Missions[id].Targets[i - 1].Objective; } States[States.Length - 1] = new MissionState(); States[States.Length - 1].Type = MissionStateType.Landing; States[States.Length - 1].Target = LandingObject; States[States.Length - 1].MissionStateText = "Land on the runway"; FinalPayment = TransportGOController.Instance.Missions [id].Payment; EventController.Instance.Subscribe("Takeoff", this); EventController.Instance.Subscribe("Landing", this); EventController.Instance.Subscribe("Crash", this); EventController.Instance.Subscribe("ViewZoneEnter", this); EventController.Instance.Subscribe("ViewZoneExit", this); EventController.Instance.Subscribe("MissionObjectDestroyed", this); EventController.Instance.Subscribe("MissionFinished", this); }
public void Offer() { if (State != MissionState.Open && State != MissionState.Suppressed) throw new InvalidOperationException(); State = MissionState.Offering; }
public Mission(string codeName, MissionState state) { this.CodeName = codeName; this.State = state; }
void CheckPerimeter() { if (!perimeter.upToDate) { perimeter.upToDate = ReassignSectorPriorities(); if (!perimeter.upToDate) { Debug.Log("Reassigning sector priorities failed."); } } List <GameObject> bogieGOs = new List <GameObject>(bogies.Capacity); NTools.Disposition enemyDisposition; // determine enemy heading range etc i.e disposition if (bogies.Count != 0) { for (int i = 0; i < bogies.Count; i++) { if (bogies[i].bogieObject != null) { bogieGOs.Add(bogies[i].bogieObject); } } enemyDisposition = NTools.AnalyseGroupDisposition( perimeter.center, perimeter.headingFloat, bogieGOs ); enemyGeneralPosition = enemyDisposition.centerOfMass; } else { enemyGeneralPosition = new Vector3(0f, 0f, 0f); } //TODO Optimize - determines perimeter anchor, heading2D and headingFloat. Is gud. if (objective.objectiveSet) { // If this happens, the game is lost or won, which will be caught by CheckObjective method if (!objective.objectiveObject) { return; } if (objective.objectiveIsFriendly) { perimeter.perimeterAnchor = objective.objectiveObject; perimeter.heading2D = new Vector2( enemyGeneralPosition.x - perimeter.perimeterAnchor.transform.position.x, enemyGeneralPosition.y - perimeter.perimeterAnchor.transform.position.y ); perimeter.headingFloat = NTools.HeadingFromVector(perimeter.heading2D); } else if (!objective.objectiveIsFriendly) { perimeter.perimeterAnchor = DeterminePerimeterAnchor(); if (perimeter.perimeterAnchor != null) { perimeter.heading2D = new Vector2( enemyGeneralPosition.x - perimeter.perimeterAnchor.transform.position.x, enemyGeneralPosition.y - perimeter.perimeterAnchor.transform.position.y ); perimeter.headingFloat = NTools.HeadingFromVector(perimeter.heading2D); } else { missionState = MissionState.lost; } } } else { perimeter.perimeterAnchor = DeterminePerimeterAnchor(); if (perimeter.perimeterAnchor != null) { perimeter.heading2D = new Vector2( enemyGeneralPosition.x - perimeter.perimeterAnchor.transform.position.x, enemyGeneralPosition.y - perimeter.perimeterAnchor.transform.position.y ); perimeter.headingFloat = NTools.HeadingFromVector(perimeter.heading2D); } else { missionState = MissionState.lost; } } }
public void ReportCivWpReached() { missionState = MissionState.won; }
public CustomMissionScreen(MissionState mt) : base(mt) { }
void Update() { Debug.Log(TimeRemaining); if (missionState == MissionState.Active) { TimeRemaining -= Time.deltaTime; if (TimeRemaining <= 0) { missionState = MissionState.Completed; } } }
public void SetMissionState(MissionState newMissionState) { missionState = newMissionState; }
public void Assign() { if (State != MissionState.Offering) throw new InvalidOperationException(); State = MissionState.Assigned; }
// private List<IMission> missions; public Mission(string codeName, MissionState missionState) { this.CodeName = codeName; this.MissionState = missionState; }
public void Complete() { if (State != MissionState.Assigned) throw new InvalidOperationException(); State = MissionState.Completed; }
public void CompleteMission() { this.MissionState = MissionState.Finished; }
public void Suppress() { if (State != MissionState.Offering) throw new InvalidOperationException(); State = MissionState.Suppressed; }
public static Mission OpenCastleAssassination( IEncounterProvider encounterProvider, ILocationCharacterProvider locationCharacterProvider, IDialogProvider dialogProvider, IMissionOutcomeHandler missionOutcomeHandler, IAssassinationActions assassinationActions, Settlement settlement, Hero assassinationTarget, bool sneakInSuccessful ) { var encounterConfig = encounterProvider.GetSneakInEncounter(settlement); var locationToOpen = settlement.LocationComplex.GetLocationWithId(encounterConfig.LocationId); PlayerEncounter.Current.AddLocationEncounter(encounterConfig.LocationEncounter); var sceneName = locationToOpen.GetSceneName(encounterConfig.WallLevel); var missionRecord = SandBoxMissions.CreateSandBoxMissionInitializerRecord(sceneName, string.Empty, true); var missionBehaviors = new List <MissionBehaviour> { new MissionOptionsComponent(), new CampaignMissionComponent(), new MissionBasicTeamLogic(), //new BasicLeaveMissionLogic(),// maybe implement own //new LeaveMissionLogic(),//maybe implement own new MissionAgentLookHandler(), new MissionConversationHandler(), new MissionAgentHandler(locationToOpen, null), new HeroSkillHandler(), new MissionFightHandler(), new BattleAgentLogic(), new AgentTownAILogic(), //not sure, maybe implement my own version new MissionCrimeHandler(), // maybe keep new MissionFacialAnimationHandler(), //new MissionDebugHandler(), //new LocationItemSpawnHandler(),// remove? //new VisualTrackerMissionBehavior(), new CastleAssassinationController(locationCharacterProvider, assassinationTarget, sneakInSuccessful), new AssassinationOutcomeLogic(missionOutcomeHandler, assassinationActions, settlement, assassinationTarget, sneakInSuccessful), new AssassinationConversationLogic(dialogProvider, Campaign.Current.ConversationManager, assassinationTarget.CharacterObject, sneakInSuccessful) }; if (!sneakInSuccessful) { missionBehaviors.Add(new AssassinationCaughtByGuardsLogic(locationCharacterProvider, Campaign.Current.ConversationManager, settlement, assassinationTarget)); } // Hacky way to disable exiting via the doors - I don't know how to lock the doors yet var cachedLocations = locationToOpen.LocationsOfPassages.ToList(); locationToOpen.LocationsOfPassages.Clear(); // I don't think I like this missionOutcomeHandler.Initialise((settl, ass) => { OpenCapturedConversation( encounterProvider, dialogProvider, assassinationActions, settl, ass ); }, () => { locationToOpen.LocationsOfPassages.AddRange(cachedLocations); }); return(MissionState.OpenNew("CastleAssassination", missionRecord, (Mission mission) => missionBehaviors, true, true, true)); }
public void Update(long elapsedMillis) { int reachedDistance=50; if (MissionState.running.Equals(state)){ time-=elapsedMillis; if ((int)playerCar.carCon.Speed==0){ double distance=Math.Sqrt(Math.Pow(end.X-playerCar.Location.X,2)+Math.Pow(end.Y-playerCar.Location.Y,2)); if (distance<reachedDistance){ state=MissionState.finished; Finished = true; } } if (time<=0){ state=MissionState.failed; Failed = true; } } else if (MissionState.waiting.Equals(state)){ if ((int)playerCar.carCon.Speed == 0) { double distance=Math.Sqrt(Math.Pow(start.X-playerCar.Location.X,2)+Math.Pow(start.Y-playerCar.Location.Y,2)); if (distance<reachedDistance){ state=MissionState.running; } } } }
public void Display() { DataGridViewColumn sortcol = dataGridViewCombat.SortedColumn != null ? dataGridViewCombat.SortedColumn : dataGridViewCombat.Columns[0]; SortOrder sortorder = dataGridViewCombat.SortOrder != SortOrder.None ? dataGridViewCombat.SortOrder : SortOrder.Descending; dataGridViewCombat.Rows.Clear(); total_kills = faction_kills = total_reward = faction_reward = balance = total_crimes = 0; if (current != null) { //System.Diagnostics.Debug.WriteLine("Filter {0} {1}", current.StartTime.ToStringZulu(), current.EndTime.ToStringZulu()); List <HistoryEntry> hel; if (current.Type == FilterEntry.EntryType.Lastdock) { hel = discoveryform.history.FilterToLastDock(); } else if (current.Type == FilterEntry.EntryType.All) { hel = discoveryform.history.LastFirst; } else if (current.Type == FilterEntry.EntryType.Oneday) { hel = discoveryform.history.FilterByDateRangeLatestFirst(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow); } else if (current.Type == FilterEntry.EntryType.Sevendays) { hel = discoveryform.history.FilterByDateRangeLatestFirst(DateTime.UtcNow.AddDays(-7), DateTime.UtcNow); } else if (current.Type == FilterEntry.EntryType.Today) { hel = discoveryform.history.FilterByDateRangeLatestFirst(DateTime.UtcNow.Date, DateTime.UtcNow); } else if (current.Type == FilterEntry.EntryType.Mission) { // look up the mission in the current data MissionState ml = current.MissionKey != null && discoveryform.history.GetLast.MissionList.Missions.ContainsKey(current.MissionKey) ? discoveryform.history.GetLast.MissionList.Missions[current.MissionKey] : null; hel = ml != null?discoveryform.history.FilterByDateRangeLatestFirst(current.StartTimeUTC, ml.MissionEndTime) : new List <HistoryEntry>(); } else { hel = discoveryform.history.FilterByDateRangeLatestFirst(current.StartTimeUTC, current.EndTimeUTC); } var rows = new List <DataGridViewRow>(hel.Count); foreach (HistoryEntry he in hel) { //System.Diagnostics.Debug.WriteLine("Combat Add {0} {1} {2}", he.EventTimeUTC.ToStringZulu(), he.EventSummary, he.EventDescription); var row = createRow(he); if (row != null) { rows.Add(row); } } dataGridViewCombat.Rows.AddRange(rows.ToArray()); } dataGridViewCombat.Sort(sortcol, (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending); dataGridViewCombat.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder; SetLabels(); }