private void BuildOccupyRegionObjective(GameObject parent, JObject objective, string name, string title, string guid, bool isPrimaryObjectve, int priority, bool displayToUser, string contractObjectiveGuid) { string lanceToUseRegionGuid = objective["LanceToUseRegionGuid"].ToString(); string regionGuid = objective["RegionGuid"].ToString(); string progressFormat = (objective.ContainsKey("ProgressFormat")) ? objective["ProgressFormat"].ToString() : ""; string description = objective["Description"].ToString(); int numberOfUnitsToOccupy = (objective.ContainsKey("NumberOfUnitsToOccupy")) ? (int)objective["NumberOfUnitsToOccupy"] : 0; int durationToOccupy = (objective.ContainsKey("DurationToOccupy")) ? (int)objective["DurationToOccupy"] : 0; bool useDropship = (objective.ContainsKey("UseDropship")) ? (bool)objective["UseDropship"] : false; string[] requiredTagsOnUnit = (objective.ContainsKey("RequiredTagsOnUnit")) ? ((JArray)objective["RequiredTagsOnUnit"]).ToObject <string[]>() : null; string[] requiredTagsOnOpposingUnits = (objective.ContainsKey("RequiredTagsOpposingUnits")) ? ((JArray)objective["RequiredTagsOpposingUnits"]).ToObject <string[]>() : null; OccupyRegionObjective occupyRegionObjective = ObjectiveFactory.CreateOccupyRegionObjective( guid, parent, contractObjectiveGuid, lanceToUseRegionGuid, regionGuid, this.name, title, progressFormat, description, numberOfUnitsToOccupy, durationToOccupy, useDropship, requiredTagsOnUnit, requiredTagsOnOpposingUnits ); }
public static OccupyRegionObjective CreateOccupyRegionObjective(string objectiveGuid, GameObject parent, string requiredLanceSpawnerGuid, string regionGameLogicGuid, string objectName, string title, string progressFormat, string description, bool useDropship) { GameObject occupyRegionObjectiveGo = new GameObject($"Objective_{objectName}"); occupyRegionObjectiveGo.transform.parent = parent.transform; occupyRegionObjectiveGo.transform.localPosition = Vector3.zero; OccupyRegionObjective occupyRegionObjective = occupyRegionObjectiveGo.AddComponent <OccupyRegionObjective>(); occupyRegionObjective.title = occupyRegionObjectiveGo.name; occupyRegionObjective.encounterObjectGuid = objectiveGuid; occupyRegionObjective.requiredTagsOnUnit = new TagSet(new string[] { "player_unit" }); LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef(); lanceSpawnerRef.EncounterObjectGuid = requiredLanceSpawnerGuid; occupyRegionObjective.requiredLance = lanceSpawnerRef; occupyRegionObjective.durationType = DurationType.AfterMoveComplete; occupyRegionObjective.durationToOccupy = 1; occupyRegionObjective.applyTagsWhen = ApplyTagsWhen.OnCompleteObjective; occupyRegionObjective.requiredTagsOnOpposingUnits = new TagSet(new string[] { "opposing_unit" }); RegionRef regionRef = new RegionRef(); regionRef.EncounterObjectGuid = regionGameLogicGuid; occupyRegionObjective.occupyTargetRegion = regionRef; occupyRegionObjective.triggerDropshipFlybyPickupOnSuccess = useDropship; occupyRegionObjective.extractViaDropship = useDropship; occupyRegionObjective.title = title; occupyRegionObjective.showProgress = true; occupyRegionObjective.progressFormat = progressFormat; occupyRegionObjective.description = description; occupyRegionObjective.priority = 3; occupyRegionObjective.displayToUser = true; occupyRegionObjective.checkObjectiveFlag = false; occupyRegionObjective.useBeacon = true; occupyRegionObjective.markUnitsWith = ObjectiveMark.None; occupyRegionObjective.enableObjectiveLogging = true; occupyRegionObjective.onSuccessDialogue = new DialogueRef(); return(occupyRegionObjective); }
public static OccupyRegionObjective CreateOccupyRegionObjective(string objectiveGuid, GameObject parent, string contractObjectiveGuid, string requiredLanceSpawnerGuid, string regionGameLogicGuid, string objectName, string title, string progressFormat, string description, int numberOfUnitsToOccupy, int durationToOccupy, bool useDropship, string[] requiredTagsOnUnit, string[] requiredTagsOnOpposingUnits) { GameObject occupyRegionObjectiveGo = CreateGameObject(parent, objectName); OccupyRegionObjective occupyRegionObjective = occupyRegionObjectiveGo.AddComponent <OccupyRegionObjective>(); occupyRegionObjective.title = occupyRegionObjectiveGo.name; occupyRegionObjective.encounterObjectGuid = objectiveGuid; occupyRegionObjective.requiredTagsOnUnit = (requiredTagsOnUnit == null) ? new TagSet(new string[] { "player_unit" }) : new TagSet(requiredTagsOnUnit); LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef(); lanceSpawnerRef.EncounterObjectGuid = requiredLanceSpawnerGuid; occupyRegionObjective.requiredLance = lanceSpawnerRef; occupyRegionObjective.durationType = DurationType.AfterMoveComplete; occupyRegionObjective.durationToOccupy = 1; occupyRegionObjective.numberOfUnitsToOccupy = numberOfUnitsToOccupy; occupyRegionObjective.applyTagsWhen = ApplyTagsWhen.OnCompleteObjective; occupyRegionObjective.requiredTagsOnOpposingUnits = (requiredTagsOnOpposingUnits == null) ? new TagSet(new string[] { "opposing_unit" }) : new TagSet(requiredTagsOnOpposingUnits); RegionRef regionRef = new RegionRef(); regionRef.EncounterObjectGuid = regionGameLogicGuid; occupyRegionObjective.occupyTargetRegion = regionRef; occupyRegionObjective.triggerDropshipFlybyPickupOnSuccess = useDropship; occupyRegionObjective.extractViaDropship = useDropship; occupyRegionObjective.title = title; occupyRegionObjective.showProgress = true; occupyRegionObjective.progressFormat = progressFormat; occupyRegionObjective.description = description; occupyRegionObjective.priority = 3; occupyRegionObjective.displayToUser = true; occupyRegionObjective.checkObjectiveFlag = false; occupyRegionObjective.useBeacon = true; occupyRegionObjective.markUnitsWith = ObjectiveMark.None; occupyRegionObjective.enableObjectiveLogging = true; AttachRequiredReferences(occupyRegionObjective, contractObjectiveGuid); return(occupyRegionObjective); }
public override void Run(RunPayload payload) { if (!state.GetBool("Chunk_Withdraw_Exists")) { Main.Logger.Log($"[AddWithdrawChunk] Adding encounter structure"); string playerSpawnerGuid = GetPlayerSpawnGuid(); EmptyCustomChunkGameLogic emptyCustomChunk = ChunkFactory.CreateEmptyCustomChunk("Chunk_Withdraw"); GameObject escapeChunkGo = emptyCustomChunk.gameObject; emptyCustomChunk.encounterObjectGuid = chunkGuid; emptyCustomChunk.startingStatus = EncounterObjectStatus.Inactive; emptyCustomChunk.notes = debugDescription; RegionFactory.CreateRegion(escapeChunkGo, regionGameLogicGuid, objectiveGuid, "Region_Withdraw", "regionDef_EvacZone"); bool useDropship = true; OccupyRegionObjective occupyRegionObjective = ObjectiveFactory.CreateOccupyRegionObjective( objectiveGuid, escapeChunkGo, null, playerSpawnerGuid, regionGameLogicGuid, "Withdraw", "Get to the Evac Zone", $"with {ProgressFormat.UNITS_OCCUPYING_SO_FAR}/{ProgressFormat.NUMBER_OF_UNITS_TO_OCCUPY} unit(s)", "The objective for the player to withdraw and complete, or withdraw, the mission", 0, 0, useDropship, new string[] { MissionControl.Instance.IsCustomContractType ? "Player 1" : "player_unit" }, new string[] { "opposing_unit" } ); ObjectiveFactory.CreateContractObjective(occupyRegionObjective); } else { Main.Logger.Log($"[AddWithdrawChunk] 'Chunk_Withdraw' already exists in map. No need to recreate."); } }