Exemple #1
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;
            }
        }
        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);
            }
        }