Example #1
0
        private static void SpawnFamily(Enemy type, Vector3 position, float difficulty = 1f)
        {
            Vector3      spawnLocation = position;
            Quaternion   spawnRotation = UnityEngine.Random.rotation;
            GameObject   GO            = Instantiate(Resources.Load <GameObject>("instantMutantSpawner"), spawnLocation, spawnRotation);
            spawnMutants spawner       = GO.GetComponent <spawnMutants>();

            spawner.instantSpawn  = true;
            spawner.sleepingSpawn = false;

            switch (type)
            {
            case Enemy.family_painted:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.male, Mathf.CeilToInt(4 * difficulty));
                AddEnemy(ref GO, Enemy.female, Mathf.CeilToInt(1 * difficulty));
                spawner.leader       = true;
                spawner.paintedTribe = true;
                spawner.pale         = false;
                break;

            case Enemy.family_regular:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.male, Mathf.CeilToInt(4 * difficulty));
                AddEnemy(ref GO, Enemy.female, Mathf.CeilToInt(1 * difficulty));
                spawner.leader = true;
                spawner.pale   = false;
                break;

            case Enemy.family_skinned:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.pale, Mathf.CeilToInt(2 * difficulty));
                AddEnemy(ref GO, Enemy.pale_skinny, Mathf.CeilToInt(3 * difficulty));
                spawner.leader       = true;
                spawner.paintedTribe = false;
                spawner.pale         = true;
                spawner.skinnedTribe = true;
                break;

            case Enemy.family_skinny:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.female_skinny, Mathf.CeilToInt(2 * difficulty));
                AddEnemy(ref GO, Enemy.male_skinny, Mathf.CeilToInt(3 * difficulty));
                spawner.leader = true;
                spawner.pale   = false;
                break;

            case Enemy.horde_kkk:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.fireman, Mathf.CeilToInt(4 * difficulty));
                spawner.leader       = true;
                spawner.paintedTribe = true;
                spawner.pale         = true;
                spawner.skinnedTribe = true;
                break;

            case Enemy.horde_baby:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.baby, Mathf.CeilToInt(10 * difficulty));
                break;

            case Enemy.horde_creepy:
                Reset(ref GO);
                AddEnemy(ref GO, Enemy.fat, Mathf.CeilToInt(2 * difficulty));
                AddEnemy(ref GO, Enemy.vags, Mathf.CeilToInt(1 * difficulty));
                AddEnemy(ref GO, Enemy.armsy, Mathf.CeilToInt(1 * difficulty));
                break;
            }
            spawner.SendMessage("doSpawn");
            Reset(ref GO);
        }
Example #2
0
    public IEnumerator addToHordeSpawn()
    {
        if (BoltNetwork.isClient)
        {
            yield break;
        }
        this.allWorldSpawns.RemoveAll((GameObject o) => o == null);
        this.allCaveSpawns.RemoveAll((GameObject o) => o == null);
        this.currentMaxActiveMutants = 25;
        this.sortSpawnPointsByDistance();
        this.spawnCounter = this.spawnCounterMin;
        if (this.allWorldSpawns.Count < 6 || this.activeWorldCannibals.Count < 8)
        {
            Transform spawnPoint = this.allSpawnPoints[this.spawnCounter].transform;
            this.spawnCounter++;
            if (this.spawnCounter >= 6)
            {
                this.spawnCounter = this.spawnCounterMin;
            }
            GameObject   newSpawn = UnityEngine.Object.Instantiate <GameObject>(this.spawnGo, spawnPoint.position, spawnPoint.rotation);
            spawnMutants spawn    = newSpawn.GetComponent <spawnMutants>();
            if (this.initMutantSpawnerCallback != null)
            {
                if (this.initMutantSpawnerCallback(spawn))
                {
                }
            }
            else
            {
                int num = UnityEngine.Random.Range(0, 15);
                if (num < 3)
                {
                    this.setupSkinnySpawn(spawn);
                }
                else if (num > 3 && num < 5)
                {
                    this.setupSkinnyPaleSpawn(spawn);
                }
                else if (num > 5 && num < 9)
                {
                    this.setupRegularSpawn(spawn);
                }
                else if (num > 9 && num < 12)
                {
                    this.setupPaleSpawn(spawn);
                }
                else if (num > 12 && num < 14)
                {
                    this.setupCreepySpawn(spawn);
                }
            }
            spawn.enabled = true;
            spawn.invokeSpawn();
            spawn.addToWorldSpawns();
            this.numActiveCannibals = this.activeWorldCannibals.Count;
            this.worldMutantsActive = false;
            yield return(YieldPresets.WaitPointTwoFiveSeconds);

            if (spawn)
            {
                spawn.SendMessage("updateSpawnConditions", SendMessageOptions.DontRequireReceiver);
            }
        }
        this.count = 0;
        yield break;
    }