Example #1
0
    private void setupRegularPaintedSpawn(spawnMutants spawn)
    {
        spawn.amount_male   = UnityEngine.Random.Range(2, 4);
        spawn.amount_female = UnityEngine.Random.Range(0, 3);
        float num = 0.6f;

        if (GameSetup.IsHardMode)
        {
            num = 0.35f;
        }
        if (UnityEngine.Random.value > num && Clock.Day > 6)
        {
            if (GameSetup.IsHardMode)
            {
                spawn.amount_fireman = UnityEngine.Random.Range(0, 3);
            }
            else
            {
                spawn.amount_fireman = UnityEngine.Random.Range(0, 2);
            }
        }
        spawn.paintedTribe = true;
        spawn.leader       = true;
        this.numActivePaintedSpawns++;
        this.numActiveSpawns++;
    }
Example #2
0
 private void setupSkinnySpawn(spawnMutants spawn)
 {
     if (Clock.Day < 6)
     {
         spawn.amount_female_skinny = UnityEngine.Random.Range(0, 2);
     }
     else
     {
         spawn.amount_female_skinny = UnityEngine.Random.Range(0, 3);
     }
     if (spawn.amount_female_skinny == 0)
     {
         spawn.amount_male_skinny = 2;
     }
     else if (Clock.Day < 6)
     {
         spawn.amount_male_skinny = UnityEngine.Random.Range(1, 3);
     }
     else
     {
         spawn.amount_male_skinny = UnityEngine.Random.Range(1, 4);
     }
     if (UnityEngine.Random.value > 0.1f && spawn.amount_male_skinny > 0)
     {
         spawn.leader = true;
     }
     else
     {
         spawn.leader = false;
     }
     this.numActiveSkinnySpawns++;
     this.numActiveSpawns++;
 }
Example #3
0
 private void activateClosestCaveSpawn()
 {
     if (this.allCaveSpawns.Count == 0)
     {
         return;
     }
     this.allCaveSpawns.RemoveAll((GameObject o) => o == null);
     foreach (GameObject gameObject in Scene.SceneTracker.allPlayersInCave)
     {
         if (gameObject)
         {
             if (this.allCaveSpawns.Count == 0)
             {
                 break;
             }
             this.sortCaveSpawnsByDistance(gameObject.transform);
             for (int i = 0; i < 14; i++)
             {
                 if ((this.allCaveSpawns[i].transform.position - gameObject.transform.position).sqrMagnitude < 32400f)
                 {
                     spawnMutants component = this.allCaveSpawns[i].GetComponent <spawnMutants>();
                     if (!component.enabled)
                     {
                         component.enabled = true;
                         component.invokeSpawn();
                     }
                 }
             }
         }
     }
 }
Example #4
0
        private void Start()
        {
            spawnMutants component = base.GetComponent <spawnMutants>();
            int          @int      = GlobalDataSaver.GetInt("sm_male_skinny_" + this._dataKey, -1337);

            if (@int > -1337)
            {
                component.amount_male_skinny = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_female_skinny_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_female_skinny = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_skinny_pale_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_skinny_pale = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_male_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_male = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_female_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_female = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_fireman_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_fireman = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_pale_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_pale = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_armsy_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_armsy = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_vags_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_vags = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_baby_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_baby = @int;
            }
            @int = GlobalDataSaver.GetInt("sm_fat_" + this._dataKey, -1337);
            if (@int > -1337)
            {
                component.amount_fat = @int;
            }
        }
Example #5
0
    public IEnumerator removeCaveMutants()
    {
        if (BoltNetwork.isClient)
        {
            yield break;
        }
        yield return(YieldPresets.WaitForFixedUpdate);

        if (this.activeCaveCannibals.Count > 0)
        {
            foreach (GameObject gameObject in this.activeCaveCannibals)
            {
                if (gameObject)
                {
                    Scene.ActiveMB.StartCoroutine(this.despawnGo(gameObject));
                }
            }
        }
        this.activeCaveCannibals.RemoveAll((GameObject o) => o == null);
        while (this.activeCaveCannibals.Count > 0)
        {
            yield return(null);
        }
        foreach (GameObject gameObject2 in this.allCaveSpawns)
        {
            if (gameObject2)
            {
                spawnMutants component = gameObject2.GetComponent <spawnMutants>();
                component.enabled = false;
            }
        }
        yield break;
    }
Example #6
0
 public void initWakeUp()
 {
     if (this.setup.spawnGo)
     {
         this.spawn = this.setup.spawnGo.GetComponent <spawnMutants>();
         if (!this.setup.ai.creepy && !this.setup.ai.creepy_male && !this.setup.ai.creepy_baby && !this.setup.ai.creepy_fat)
         {
             if (this.spawn.sleepingSpawn)
             {
                 this.fsmSleep.Value = true;
                 this.setup.pmBrain.SendEvent("toActivateFSM");
                 return;
             }
             if (Clock.Day > 0)
             {
                 this.fsmSleep.Value = false;
             }
             if (!Clock.InCave && !this.setup.pmSleep.FsmVariables.GetFsmBool("inCaveBool").Value)
             {
                 if (Clock.Day == 0 && !this.spawn.instantSpawn && !Scene.MutantControler.hordeModeActive && !Clock.Dark)
                 {
                     base.StartCoroutine(this.sendWakeUp(250f));
                 }
                 else
                 {
                     base.StartCoroutine(this.sendWakeUp(0f));
                 }
             }
             if (this.sleepBlocker)
             {
                 base.StartCoroutine(this.sendWakeUp(0f));
             }
         }
     }
 }
Example #7
0
    public IEnumerator removeAllEnemies()
    {
        if (BoltNetwork.isClient)
        {
            yield break;
        }
        yield return(YieldPresets.WaitForFixedUpdate);

        if (this.activeCannibals.Count > 0)
        {
            foreach (GameObject gameObject in this.activeCannibals)
            {
                if (gameObject)
                {
                    Scene.ActiveMB.StartCoroutine(this.despawnGo(gameObject));
                }
            }
        }
        if (this.activeBabies.Count > 0)
        {
            foreach (GameObject gameObject2 in this.activeBabies)
            {
                if (gameObject2)
                {
                    Scene.ActiveMB.StartCoroutine(this.despawnGo(gameObject2));
                }
            }
        }
        while (this.activeCannibals.Count > 0)
        {
            yield return(null);
        }
        foreach (GameObject gameObject3 in this.allWorldSpawns)
        {
            if (gameObject3)
            {
                UnityEngine.Object.Destroy(gameObject3);
            }
        }
        foreach (GameObject gameObject4 in this.allCaveSpawns)
        {
            if (gameObject4)
            {
                spawnMutants component = gameObject4.GetComponent <spawnMutants>();
                component.enabled = false;
            }
        }
        this.count                  = 0;
        this.numActiveSpawns        = 0;
        this.numActiveCreepySpawns  = 0;
        this.numActivePaleSpawns    = 0;
        this.numActiveRegularSpawns = 0;
        this.numActivePaintedSpawns = 0;
        this.numActiveSkinnySpawns  = 0;
        yield break;
    }
Example #8
0
 private void setupSkinnedSpawn(spawnMutants spawn)
 {
     spawn.amount_pale        = UnityEngine.Random.Range(1, 4);
     spawn.amount_skinny_pale = UnityEngine.Random.Range(1, 4);
     spawn.paintedTribe       = false;
     spawn.skinnedTribe       = true;
     spawn.leader             = true;
     this.numActiveSkinnedSpawns++;
     this.numActiveSpawns++;
 }
Example #9
0
 private void setupSkinnyPaleSpawn(spawnMutants spawn)
 {
     if (Clock.Day < 6)
     {
         spawn.amount_skinny_pale = UnityEngine.Random.Range(1, 4);
     }
     else
     {
         spawn.amount_skinny_pale = UnityEngine.Random.Range(2, 6);
     }
     spawn.leader = true;
     this.numActiveSkinnyPaleSpawns++;
     this.numActiveSpawns++;
 }
Example #10
0
 public void killAllBossBabies()
 {
     foreach (GameObject gameObject in this.spawnedBabies)
     {
         if (gameObject)
         {
             spawnMutants component = gameObject.GetComponent <spawnMutants>();
             if (component && component.allMembers.Count > 0)
             {
                 component.allMembers[0].SendMessage("killThisEnemy");
             }
         }
     }
 }
Example #11
0
        private static void Reset(ref GameObject obj)
        {
            spawnMutants component = obj.GetComponent <spawnMutants>();

            component.amount_male          = 0;
            component.amount_female        = 0;
            component.amount_female_skinny = 0;
            component.amount_male_skinny   = 0;
            component.amount_pale          = 0;
            component.amount_skinny_pale   = 0;
            component.amount_fireman       = 0;
            component.amount_vags          = 0;
            component.amount_armsy         = 0;
            component.amount_baby          = 0;
            component.amount_fat           = 0;
        }
Example #12
0
 public static void FindEnemies()
 {
     if (!Objects.ContainsKey("Enemy.mutant"))
     {
         spawnMutants[] m = (spawnMutants[])GameObject.FindObjectsOfTypeAll(typeof(spawnMutants));
         for (int i = 0; i < m.Length; i++)
         {
             spawnMutants mk = m[i];
             AddEnemy("mutant", mk.mutant);
             AddEnemy("mutant_female", mk.mutant_female);
             AddEnemy("mutant_pale", mk.mutant_pale);
             AddEnemy("armsy", mk.armsy);
             AddEnemy("vags", mk.vags);
             AddEnemy("baby", mk.baby);
             AddEnemy("fat", mk.fat);
         }
     }
 }
Example #13
0
 private void OnSerializing()
 {
     if (!Cheats.NoEnemies && !Cheats.NoEnemiesDuringDay)
     {
         spawnMutants component = base.GetComponent <spawnMutants>();
         GlobalDataSaver.SetInt("sm_male_skinny_" + this._dataKey, component.amount_male_skinny);
         GlobalDataSaver.SetInt("sm_female_skinny_" + this._dataKey, component.amount_female_skinny);
         GlobalDataSaver.SetInt("sm_skinny_pale_" + this._dataKey, component.amount_skinny_pale);
         GlobalDataSaver.SetInt("sm_male_" + this._dataKey, component.amount_male);
         GlobalDataSaver.SetInt("sm_female_" + this._dataKey, component.amount_female);
         GlobalDataSaver.SetInt("sm_fireman_" + this._dataKey, component.amount_fireman);
         GlobalDataSaver.SetInt("sm_pale_" + this._dataKey, component.amount_pale);
         GlobalDataSaver.SetInt("sm_armsy_" + this._dataKey, component.amount_armsy);
         GlobalDataSaver.SetInt("sm_vags_" + this._dataKey, component.amount_vags);
         GlobalDataSaver.SetInt("sm_baby_" + this._dataKey, component.amount_baby);
         GlobalDataSaver.SetInt("sm_fat_" + this._dataKey, component.amount_fat);
     }
 }
Example #14
0
    private void setupCreepySpawn(spawnMutants spawn)
    {
        spawn.amount_vags = UnityEngine.Random.Range(0, 2);
        if (spawn.amount_vags == 0)
        {
            spawn.amount_armsy = UnityEngine.Random.Range(0, 3);
        }
        else
        {
            spawn.amount_armsy = UnityEngine.Random.Range(0, 2);
        }
        int num = spawn.amount_vags + spawn.amount_armsy;

        if (Clock.Day > 12 && num < 3)
        {
            spawn.amount_fat = UnityEngine.Random.Range(0, 2);
        }
        if (spawn.amount_armsy == 0 && spawn.amount_fat == 0 && spawn.amount_vags == 0)
        {
            spawn.amount_armsy = 1;
            if (UnityEngine.Random.value > 0.5f)
            {
                spawn.amount_vags = 1;
            }
        }
        if (spawn.amount_vags > 0 && UnityEngine.Random.value > 0.5f)
        {
            spawn.amount_baby = UnityEngine.Random.Range(2, 6);
        }
        else if (UnityEngine.Random.value > 0.5f && (spawn.amount_armsy > 0 || spawn.amount_fat > 0) && num < 3)
        {
            spawn.amount_skinny_pale = UnityEngine.Random.Range(1, 4);
        }
        if (UnityEngine.Random.value > 0.7f && Clock.Day > 12)
        {
            spawn.pale = true;
        }
        spawn.leader        = true;
        spawn.creepySpawner = true;
        this.numActiveCreepySpawns++;
        this.numActiveSpawns++;
    }
Example #15
0
 public IEnumerator updateCaveSpawns()
 {
     if (this.updatingCaves)
     {
         yield break;
     }
     if (BoltNetwork.isClient)
     {
         yield break;
     }
     this.allCaveSpawns.RemoveAll((GameObject o) => o == null);
     if (!this.disableAllEnemies && !this.startDelay && !Cheats.NoEnemies)
     {
         this.updatingCaves = true;
         this.spawnCounter  = 5;
         this.count         = 0;
         while (this.count < this.allCaveSpawns.Count)
         {
             this.sortCaveSpawnsByDistance(LocalPlayer.Transform);
             if (this.allCaveSpawns[this.count] != null)
             {
                 spawnMutants component = this.allCaveSpawns[this.count].GetComponent <spawnMutants>();
                 if (!component.enabled)
                 {
                     component.enabled = true;
                     component.invokeSpawn();
                     if (!this.activeFamilies.Contains(this.allCaveSpawns[this.count]))
                     {
                         this.activeFamilies.Add(this.allCaveSpawns[this.count]);
                     }
                     this.count++;
                 }
             }
             yield return(YieldPresets.WaitForFixedUpdate);
         }
     }
     this.updatingCaves = false;
     this.count         = 0;
     yield break;
 }
Example #16
0
 private void setupPaleSpawn(spawnMutants spawn)
 {
     if (Clock.Day < 10)
     {
         spawn.amount_pale = UnityEngine.Random.Range(1, 4);
     }
     else
     {
         spawn.amount_pale = UnityEngine.Random.Range(2, 6);
     }
     if (UnityEngine.Random.value < 0.2f)
     {
         spawn.leader = false;
     }
     else
     {
         spawn.leader = true;
     }
     spawn.pale = true;
     this.numActivePaleSpawns++;
     this.numActiveSpawns++;
 }
Example #17
0
 public void disableMpCaveMutants()
 {
     base.CancelInvoke("activeClosestCaveSpawn");
     if (Scene.SceneTracker.allPlayersInCave.Count == 0 && this.activeCaveCannibals.Count > 0)
     {
         foreach (GameObject gameObject in this.activeCaveCannibals)
         {
             if (gameObject)
             {
                 base.StartCoroutine("despawnGo", gameObject);
             }
         }
     }
     if (this.allCaveSpawns.Count > 0)
     {
         foreach (GameObject gameObject2 in this.allCaveSpawns)
         {
             spawnMutants component = gameObject2.GetComponent <spawnMutants>();
             component.enabled = false;
         }
     }
 }
Example #18
0
    private void setupRegularSpawn(spawnMutants spawn)
    {
        spawn.amount_male = UnityEngine.Random.Range(1, 4);
        if (Clock.Day > 8)
        {
            spawn.amount_female = UnityEngine.Random.Range(0, 3);
        }
        else
        {
            spawn.amount_female = UnityEngine.Random.Range(0, 2);
        }
        float num = 0.6f;

        if (GameSetup.IsHardMode)
        {
            num = 0.35f;
        }
        if (UnityEngine.Random.value > num && Clock.Day > 6)
        {
            if (GameSetup.IsHardMode)
            {
                spawn.amount_fireman = UnityEngine.Random.Range(0, 3);
            }
            else
            {
                spawn.amount_fireman = UnityEngine.Random.Range(0, 2);
            }
        }
        if (UnityEngine.Random.value < 0.05f)
        {
            spawn.leader = false;
        }
        else
        {
            spawn.leader = true;
        }
        this.numActiveRegularSpawns++;
        this.numActiveSpawns++;
    }
Example #19
0
    public IEnumerator updateHordeSpawns(int delay)
    {
        yield return(new WaitForSeconds((float)delay));

        if (BoltNetwork.isClient)
        {
            yield break;
        }
        this.allWorldSpawns.RemoveAll((GameObject o) => o == null);
        this.allCaveSpawns.RemoveAll((GameObject o) => o == null);
        this.currentMaxActiveMutants = 30;
        if (!this.startDelay)
        {
            this.sortSpawnPointsByDistance();
            this.spawnCounter = this.spawnCounterMin;
            bool allSpawned = false;
            while (!allSpawned)
            {
                Transform spawnPoint = this.allSpawnPoints[this.spawnCounter].transform;
                this.spawnCounter++;
                if (this.spawnCounter >= this.allSpawnPoints.Count)
                {
                    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))
                    {
                        allSpawned = true;
                    }
                }
                else if (this.numActiveCreepySpawns < this.spawnManager.desiredCreepy)
                {
                    this.setupCreepySpawn(spawn);
                }
                else if (this.numActiveRegularSpawns < this.spawnManager.desiredRegular)
                {
                    this.setupRegularSpawn(spawn);
                }
                else if (this.numActiveSkinnedSpawns < this.spawnManager.desiredSkinned)
                {
                    this.setupSkinnedSpawn(spawn);
                }
                else if (this.numActivePaintedSpawns < this.spawnManager.desiredPainted)
                {
                    this.setupRegularPaintedSpawn(spawn);
                }
                else if (this.numActivePaleSpawns < this.spawnManager.desiredPale)
                {
                    this.setupPaleSpawn(spawn);
                }
                else if (this.numActiveSkinnyPaleSpawns < this.spawnManager.desiredSkinnyPale)
                {
                    this.setupSkinnyPaleSpawn(spawn);
                }
                else if (this.numActiveSkinnySpawns < this.spawnManager.desiredSkinny)
                {
                    this.setupSkinnySpawn(spawn);
                }
                else
                {
                    allSpawned = true;
                }
                spawn.enabled = true;
                spawn.invokeSpawn();
                spawn.addToWorldSpawns();
                this.numActiveCannibals = this.activeWorldCannibals.Count;
                this.worldMutantsActive = false;
                yield return(YieldPresets.WaitPointTwoFiveSeconds);

                if (this.activeWorldCannibals.Count >= this.currentMaxActiveMutants)
                {
                    allSpawned = true;
                }
            }
            foreach (GameObject gameObject in this.allWorldSpawns)
            {
                if (gameObject)
                {
                    gameObject.SendMessage("updateSpawnConditions", SendMessageOptions.DontRequireReceiver);
                }
            }
        }
        this.count = 0;
        yield break;
    }
Example #20
0
 private void Awake()
 {
     this.spawn = base.GetComponent <spawnMutants>();
     base.InvokeRepeating("checkSpawnDist", 0f, UnityEngine.Random.Range(4f, 6f));
     this.spawn.enabled = false;
 }
Example #21
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 #22
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;
    }
Example #23
0
        private static void AddEnemy(ref GameObject obj, Enemy type, int amount)
        {
            spawnMutants component = obj.GetComponent <spawnMutants>();

            switch (type)
            {
            case Enemy.male:
                component.amount_male = amount;
                break;

            case Enemy.female:
                component.amount_female = amount;
                break;

            case Enemy.female_skinny:
                component.amount_female_skinny = amount;
                break;

            case Enemy.male_skinny:
                component.amount_male_skinny = amount;
                break;

            case Enemy.pale:
                component.amount_pale = amount;
                break;

            case Enemy.pale_skinny:
                component.amount_skinny_pale = amount;
                break;

            case Enemy.fireman:
                component.amount_fireman = amount;
                break;

            case Enemy.vags:
                component.amount_vags = amount;
                break;

            case Enemy.armsy:
                component.amount_armsy = amount;
                break;

            case Enemy.baby:
                component.amount_baby = amount;
                break;

            case Enemy.fat:
                component.amount_fat = amount;
                break;

            case Enemy.skinnedMale:
                component.amount_pale  = amount;
                component.skinnedTribe = true;
                component.pale         = true;
                break;

            case Enemy.girl:
                component.amount_girl = amount;
                break;

            case Enemy.dynamiteman:
                component.amount_fireman = amount;
                component.useDynamiteMan = true;
                break;
            }
        }
Example #24
0
 public IEnumerator setupFamilies()
 {
     if (this.hordeModeActive)
     {
         yield break;
     }
     if (LocalPlayer.IsInCaves)
     {
         yield return(YieldPresets.WaitThreeSeconds);
     }
     Scene.ActiveMB.StopCoroutine(this.updateSpawns());
     if (BoltNetwork.isClient)
     {
         yield break;
     }
     this.calculateMainNavArea();
     this.firstTimeSetup = true;
     if (!Clock.planecrash && !this.startDelay && !Cheats.NoEnemies && !this.disableAllEnemies && !this.setupBreak)
     {
         this.setupBreak = true;
         base.Invoke("resetSetupBreak", 1f);
         if (this.activeCannibals.Count > 0)
         {
             foreach (GameObject gameObject in this.activeCannibals)
             {
                 if (gameObject)
                 {
                     Scene.ActiveMB.StartCoroutine(this.despawnGo(gameObject));
                 }
             }
         }
         while (this.activeCannibals.Count > 0)
         {
             yield return(null);
         }
         foreach (GameObject gameObject2 in this.allWorldSpawns)
         {
             if (gameObject2)
             {
                 UnityEngine.Object.Destroy(gameObject2);
             }
         }
         foreach (GameObject gameObject3 in this.allCaveSpawns)
         {
             if (gameObject3)
             {
                 spawnMutants component = gameObject3.GetComponent <spawnMutants>();
                 component.enabled = false;
             }
         }
         this.count                  = 0;
         this.numActiveSpawns        = 0;
         this.numActiveCreepySpawns  = 0;
         this.numActivePaleSpawns    = 0;
         this.numActiveRegularSpawns = 0;
         this.numActivePaintedSpawns = 0;
         this.numActiveSkinnySpawns  = 0;
         this.numActiveSkinnedSpawns = 0;
         this.setDayConditions();
         Scene.ActiveMB.StartCoroutine(this.updateSpawns());
     }
     yield break;
 }
Example #25
0
    public IEnumerator updateSpawns()
    {
        if (BoltNetwork.isClient)
        {
            yield break;
        }
        this.allWorldSpawns.RemoveAll((GameObject o) => o == null);
        this.allCaveSpawns.RemoveAll((GameObject o) => o == null);
        this.allSkinnySpawns.RemoveAll((GameObject o) => o == null);
        this.allSkinnyPaleSpawns.RemoveAll((GameObject o) => o == null);
        this.allRegularSpawns.RemoveAll((GameObject o) => o == null);
        this.allPaintedSpawns.RemoveAll((GameObject o) => o == null);
        this.allPaleSpawns.RemoveAll((GameObject o) => o == null);
        this.allCreepySpawns.RemoveAll((GameObject o) => o == null);
        this.allSkinnedSpawns.RemoveAll((GameObject o) => o == null);
        foreach (GameObject gameObject in this.allWorldSpawns)
        {
            gameObject.SendMessage("updateSpawnConditions", SendMessageOptions.DontRequireReceiver);
        }
        this.setDayConditions();
        if (Clock.Day == 0 && Scene.Atmosphere.TimeOfDay > 270f && Scene.Atmosphere.TimeOfDay < 359f && !LocalPlayer.IsInCaves)
        {
            yield return(new WaitForSeconds(0f));
        }
        if (!this.disableAllEnemies && !this.startDelay && !Cheats.NoEnemies)
        {
            this.sortSpawnPointsByDistance();
            this.spawnCounter = 4;
            bool allSpawned = false;
            while (!Scene.SceneTracker.waitForLoadSequence)
            {
                yield return(null);
            }
            while (Scene.SceneTracker.doingGlobalNavUpdate)
            {
                yield return(null);
            }
            yield return(YieldPresets.WaitOneSecond);

            yield return(YieldPresets.WaitOneSecond);

            yield return(YieldPresets.WaitOneSecond);

            while (this.mostCommonArea.Count == 0)
            {
                yield return(null);
            }
            while ((this.activeWorldCannibals.Count < this.currentMaxActiveMutants && !LocalPlayer.IsInCaves && !allSpawned) || (this.count < this.allCaveSpawns.Count && LocalPlayer.IsInCaves))
            {
                if (!LocalPlayer.IsInCaves)
                {
                    if (Cheats.NoEnemiesDuringDay && !Clock.Dark)
                    {
                        yield break;
                    }
                    Transform spawnPoint = this.allSpawnPoints[this.spawnCounter].transform;
                    this.spawnCounter++;
                    if (this.spawnCounter >= this.allSpawnPoints.Count)
                    {
                        this.spawnCounter = this.allSpawnPoints.Count;
                    }
                    GraphNode node      = AstarPath.active.GetNearest(spawnPoint.position, NNConstraint.Default).node;
                    int       areaCount = 0;
                    while (node.Area != this.mostCommonArea[areaCount])
                    {
                        node = AstarPath.active.GetNearest(this.allSpawnPoints[this.spawnCounter].transform.position, NNConstraint.Default).node;
                        areaCount++;
                        if (areaCount == this.mostCommonArea.Count)
                        {
                            areaCount = 0;
                        }
                        this.spawnCounter++;
                        if (this.spawnCounter >= this.allSpawnPoints.Count)
                        {
                            node.Area         = this.mostCommonArea[0];
                            this.spawnCounter = this.allSpawnPoints.Count;
                        }
                        spawnPoint = this.allSpawnPoints[this.spawnCounter].transform;
                        yield return(null);
                    }
                    this.lastValidSpawn = spawnPoint;
                    GameObject   newSpawn = UnityEngine.Object.Instantiate <GameObject>(this.spawnGo, spawnPoint.position, spawnPoint.rotation);
                    spawnMutants spawn    = newSpawn.GetComponent <spawnMutants>();
                    if (this.allCreepySpawns.Count < this.spawnManager.desiredCreepy)
                    {
                        this.setupCreepySpawn(spawn);
                        this.allCreepySpawns.Add(spawn.gameObject);
                    }
                    else if (this.allSkinnedSpawns.Count < this.spawnManager.desiredSkinned)
                    {
                        this.setupSkinnedSpawn(spawn);
                        this.allSkinnedSpawns.Add(spawn.gameObject);
                    }
                    else if (this.allPaintedSpawns.Count < this.spawnManager.desiredPainted)
                    {
                        this.setupRegularPaintedSpawn(spawn);
                        this.allPaintedSpawns.Add(spawn.gameObject);
                    }
                    else if (this.allRegularSpawns.Count < this.spawnManager.desiredRegular)
                    {
                        this.setupRegularSpawn(spawn);
                        this.allRegularSpawns.Add(spawn.gameObject);
                    }
                    else if (this.allPaleSpawns.Count < this.spawnManager.desiredPale)
                    {
                        this.setupPaleSpawn(spawn);
                        this.allPaleSpawns.Add(spawn.gameObject);
                    }
                    else if (this.allSkinnyPaleSpawns.Count < this.spawnManager.desiredSkinnyPale)
                    {
                        this.setupSkinnyPaleSpawn(spawn);
                        this.allSkinnyPaleSpawns.Add(spawn.gameObject);
                    }
                    else if (this.allSkinnySpawns.Count < this.spawnManager.desiredSkinny)
                    {
                        this.setupSkinnySpawn(spawn);
                        this.allSkinnySpawns.Add(spawn.gameObject);
                    }
                    else
                    {
                        allSpawned = true;
                    }
                    spawn.enabled = true;
                    spawn.invokeSpawn();
                    spawn.addToWorldSpawns();
                    this.numActiveCannibals = this.activeWorldCannibals.Count;
                    yield return(new WaitForFixedUpdate());
                }
                else if (LocalPlayer.IsInCaves)
                {
                    this.sortCaveSpawnsByDistance(LocalPlayer.Transform);
                    if (this.allCaveSpawns[this.count] != null)
                    {
                        spawnMutants component = this.allCaveSpawns[this.count].GetComponent <spawnMutants>();
                        if (!component.enabled)
                        {
                            component.enabled = true;
                            component.invokeSpawn();
                            if (!this.activeFamilies.Contains(this.allCaveSpawns[this.count]))
                            {
                                this.activeFamilies.Add(this.allCaveSpawns[this.count]);
                            }
                            this.numActiveCannibals = this.activeCannibals.Count;
                            this.count++;
                        }
                    }
                }
                this.worldMutantsActive = false;
                yield return(YieldPresets.WaitForFixedUpdate);

                yield return(YieldPresets.WaitForFixedUpdate);

                yield return(YieldPresets.WaitForFixedUpdate);

                foreach (GameObject gameObject2 in this.allWorldSpawns)
                {
                    if (gameObject2)
                    {
                        gameObject2.SendMessage("updateSpawnConditions", SendMessageOptions.DontRequireReceiver);
                    }
                }
            }
        }
        this.count = 0;
        yield break;
    }