public override void Run(RunPayload payload)
        {
            Main.Logger.Log($"[AddDestroyWholeUnitChunk] Adding encounter structure");
            EncounterLayerData     encounterLayerData = MissionControl.Instance.EncounterLayerData;
            DestroyWholeLanceChunk destroyWholeChunk  = ChunkFactory.CreateDestroyWholeLanceChunk();

            destroyWholeChunk.encounterObjectGuid = System.Guid.NewGuid().ToString();

            this.objectiveLabel = MissionControl.Instance.CurrentContract.Interpolate(this.objectiveLabel).ToString();

            bool spawnOnActivation             = true;
            LanceSpawnerGameLogic lanceSpawner = LanceSpawnerFactory.CreateLanceSpawner(
                destroyWholeChunk.gameObject,
                spawnerName,
                lanceGuid,
                teamGuid,
                spawnOnActivation,
                SpawnUnitMethodType.InstantlyAtSpawnPoint,
                unitGuids
                );
            LanceSpawnerRef lanceSpawnerRef = new LanceSpawnerRef(lanceSpawner);

            bool showProgress = true;
            DestroyLanceObjective objective = ObjectiveFactory.CreateDestroyLanceObjective(
                objectiveGuid,
                destroyWholeChunk.gameObject,
                lanceSpawnerRef,
                lanceGuid,
                objectiveLabel,
                showProgress,
                ProgressFormat.PERCENTAGE_COMPLETE,
                "The primary objective to destroy the enemy lance",
                priority,
                displayToUser,
                ObjectiveMark.AttackTarget,
                contractObjectiveGameLogicGuid,
                Main.Settings.ActiveAdditionalLances.GetRewards()
                );

            if (isPrimary)
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objective, true);
            }
            else
            {
                AccessTools.Field(typeof(ObjectiveGameLogic), "primary").SetValue(objective, false);
            }

            DestroyLanceObjectiveRef destroyLanceObjectiveRef = new DestroyLanceObjectiveRef();

            destroyLanceObjectiveRef.encounterObject = objective;

            destroyWholeChunk.lanceSpawner     = lanceSpawnerRef;
            destroyWholeChunk.destroyObjective = destroyLanceObjectiveRef;
        }
Ejemplo n.º 2
0
        public override void Run(RunPayload payload)
        {
            Main.Logger.Log($"[AddLanceSpawnChunk] Adding encounter structure");
            EncounterLayerData        encounterLayerData = MissionControl.Instance.EncounterLayerData;
            EmptyCustomChunkGameLogic emptyCustomChunk   = ChunkFactory.CreateEmptyCustomChunk("Chunk_Lance");

            emptyCustomChunk.encounterObjectGuid = System.Guid.NewGuid().ToString();
            emptyCustomChunk.notes = debugDescription;

            bool spawnOnActivation             = true;
            LanceSpawnerGameLogic lanceSpawner = LanceSpawnerFactory.CreateLanceSpawner(
                emptyCustomChunk.gameObject,
                spawnerName,
                lanceGuid,
                teamGuid,
                spawnOnActivation,
                SpawnUnitMethodType.InstantlyAtSpawnPoint,
                unitGuids
                );

            lanceSpawner.transform.position = Vector3.zero;
        }
Ejemplo n.º 3
0
        public override void Build()
        {
            SpawnUnitMethodType spawnMethodType = SpawnUnitMethodType.ViaLeopardDropship;

            switch (spawnType)
            {
            case "Leopard": spawnMethodType = SpawnUnitMethodType.ViaLeopardDropship; break;

            case "DropPod": spawnMethodType = SpawnUnitMethodType.DropPod; break;

            case "Instant": spawnMethodType = SpawnUnitMethodType.InstantlyAtSpawnPoint; break;

            default: Main.LogDebug($"[SpawnBuilder.{contractTypeBuilder.ContractTypeKey}] No support for spawnType '{spawnType}'. Check for spelling mistakes."); break;
            }

            string teamId = EncounterRules.PLAYER_TEAM_ID;

            switch (team)
            {
            case "Player1": {
                teamId = EncounterRules.PLAYER_TEAM_ID;
                PlayerLanceSpawnerGameLogic playerLanceSpawnerGameLogic = LanceSpawnerFactory.CreatePlayerLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids, true);
                if (position != null)
                {
                    SetPosition(playerLanceSpawnerGameLogic.gameObject, position);
                }
                if (rotation != null)
                {
                    SetRotation(playerLanceSpawnerGameLogic.gameObject, rotation);
                }
                break;
            }

            case "Target": {
                teamId = EncounterRules.TARGET_TEAM_ID;
                LanceSpawnerGameLogic lanceSpawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                if (position != null)
                {
                    SetPosition(lanceSpawnerGameLogic.gameObject, position);
                }
                if (rotation != null)
                {
                    SetRotation(lanceSpawnerGameLogic.gameObject, rotation);
                }
                break;
            }

            case "TargetAlly": {
                teamId = EncounterRules.TARGETS_ALLY_TEAM_ID;
                LanceSpawnerGameLogic lanceSpawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                if (position != null)
                {
                    SetPosition(lanceSpawnerGameLogic.gameObject, position);
                }
                if (rotation != null)
                {
                    SetRotation(lanceSpawnerGameLogic.gameObject, rotation);
                }
                break;
            }

            case "Employer": {
                teamId = EncounterRules.EMPLOYER_TEAM_ID;
                LanceSpawnerGameLogic lanceSpawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                if (position != null)
                {
                    SetPosition(lanceSpawnerGameLogic.gameObject, position);
                }
                if (rotation != null)
                {
                    SetRotation(lanceSpawnerGameLogic.gameObject, rotation);
                }
                break;
            }

            default: Main.LogDebug($"[SpawnBuilder.{contractTypeBuilder.ContractTypeKey}] No support for team '{team}'. Check for spelling mistakes."); break;
            }
        }
Ejemplo n.º 4
0
        public override void Build()
        {
            SpawnUnitMethodType spawnMethodType = SpawnUnitMethodType.ViaLeopardDropship;

            switch (spawnType)
            {
            case "Leopard": spawnMethodType = SpawnUnitMethodType.ViaLeopardDropship; break;

            case "DropPod": spawnMethodType = SpawnUnitMethodType.DropPod; break;

            case "Instant": spawnMethodType = SpawnUnitMethodType.InstantlyAtSpawnPoint; break;

            default: Main.LogDebug($"[SpawnBuilder.{contractTypeBuilder.ContractTypeKey}] No support for spawnType '{spawnType}'. Check for spelling mistakes."); break;
            }

            LanceSpawnerGameLogic spawnerGameLogic = null;

            string teamId = TeamUtils.PLAYER_TEAM_ID;

            switch (team)
            {
            case "Player1": {
                teamId           = TeamUtils.PLAYER_TEAM_ID;
                spawnerGameLogic = LanceSpawnerFactory.CreatePlayerLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids, true);
                break;
            }

            case "Target": {
                teamId           = TeamUtils.TARGET_TEAM_ID;
                spawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                spawnerGameLogic.alertLanceOnSpawn = this.alertLanceOnSpawn;
                if (orders != null)
                {
                    spawnerGameLogic.aiOrderList.contentsBox = orders;
                }
                break;
            }

            case "TargetAlly": {
                teamId           = TeamUtils.TARGETS_ALLY_TEAM_ID;
                spawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                spawnerGameLogic.alertLanceOnSpawn = this.alertLanceOnSpawn;
                if (orders != null)
                {
                    spawnerGameLogic.aiOrderList.contentsBox = orders;
                }
                break;
            }

            case "Employer": {
                teamId           = TeamUtils.EMPLOYER_TEAM_ID;
                spawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                spawnerGameLogic.alertLanceOnSpawn = this.alertLanceOnSpawn;
                if (orders != null)
                {
                    spawnerGameLogic.aiOrderList.contentsBox = orders;
                }
                break;
            }

            case "NeutralToAll": {
                teamId           = TeamUtils.NEUTRAL_TO_ALL_TEAM_ID;
                spawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                spawnerGameLogic.alertLanceOnSpawn = this.alertLanceOnSpawn;
                if (orders != null)
                {
                    spawnerGameLogic.aiOrderList.contentsBox = orders;
                }
                break;
            }

            case "HostileToAll": {
                teamId           = TeamUtils.HOSTILE_TO_ALL_TEAM_ID;
                spawnerGameLogic = LanceSpawnerFactory.CreateLanceSpawner(parent, name, guid, teamId, true, spawnMethodType, spawnPointGuids);
                spawnerGameLogic.alertLanceOnSpawn = this.alertLanceOnSpawn;
                if (orders != null)
                {
                    spawnerGameLogic.aiOrderList.contentsBox = orders;
                }
                break;
            }

            default: Main.Logger.LogError($"[SpawnBuilder.{contractTypeBuilder.ContractTypeKey}] No support for team '{team}'. Check for spelling mistakes."); break;
            }

            if (this.position != null)
            {
                SetPosition(spawnerGameLogic.gameObject, this.position);
            }
            if (this.rotation != null)
            {
                SetRotation(spawnerGameLogic.gameObject, this.rotation);
            }
            if (this.mountOnTargets != null)
            {
                SetMountOnPositions(spawnerGameLogic, this.mountOnTargets);
            }
            if (this.spawnPointPositions != null)
            {
                SetSpawnPointPositions(spawnerGameLogic);
            }
            if (this.spawnPointRotations != null)
            {
                SetSpawnPointRotations(spawnerGameLogic);
            }
            if (this.defaultDetectionRange > 0)
            {
                SetDefaultDetectionRange(spawnerGameLogic, this.defaultDetectionRange);
            }
            if (this.tags != null)
            {
                spawnerGameLogic.encounterTags.AddRange(this.tags);
            }
        }