Example #1
0
 public static void removeTable()
 {
     LevelZombies.tables.RemoveAt((int)EditorSpawns.selectedZombie);
     for (byte b = 0; b < Regions.WORLD_SIZE; b += 1)
     {
         for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1)
         {
             List <ZombieSpawnpoint> list = new List <ZombieSpawnpoint>();
             for (int i = 0; i < LevelZombies.spawns[(int)b, (int)b2].Count; i++)
             {
                 ZombieSpawnpoint zombieSpawnpoint = LevelZombies.spawns[(int)b, (int)b2][i];
                 if (zombieSpawnpoint.type == EditorSpawns.selectedZombie)
                 {
                     Object.Destroy(zombieSpawnpoint.node.gameObject);
                 }
                 else
                 {
                     if (zombieSpawnpoint.type > EditorSpawns.selectedZombie)
                     {
                         ZombieSpawnpoint zombieSpawnpoint2 = zombieSpawnpoint;
                         zombieSpawnpoint2.type -= 1;
                     }
                     list.Add(zombieSpawnpoint);
                 }
             }
             LevelZombies._spawns[(int)b, (int)b2] = list;
         }
     }
     EditorSpawns.selectedZombie = 0;
     if ((int)EditorSpawns.selectedZombie < LevelZombies.tables.Count)
     {
         EditorSpawns.zombieSpawn.GetComponent <Renderer>().material.color = LevelZombies.tables[(int)EditorSpawns.selectedZombie].color;
     }
 }
Example #2
0
 public static void removeSpawn(Vector3 point, float radius)
 {
     radius *= radius;
     for (byte b = 0; b < Regions.WORLD_SIZE; b += 1)
     {
         for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1)
         {
             List <ZombieSpawnpoint> list = new List <ZombieSpawnpoint>();
             for (int i = 0; i < LevelZombies.spawns[(int)b, (int)b2].Count; i++)
             {
                 ZombieSpawnpoint zombieSpawnpoint = LevelZombies.spawns[(int)b, (int)b2][i];
                 if ((zombieSpawnpoint.point - point).sqrMagnitude < radius)
                 {
                     Object.Destroy(zombieSpawnpoint.node.gameObject);
                 }
                 else
                 {
                     list.Add(zombieSpawnpoint);
                 }
             }
             LevelZombies._spawns[(int)b, (int)b2] = list;
         }
     }
 }
Example #3
0
 public void UpdateBoss()
 {
     if (this.bossZombie != null)
     {
         return;
     }
     for (int i = 0; i < Provider.clients.Count; i++)
     {
         SteamPlayer steamPlayer = Provider.clients[i];
         if (!(steamPlayer.player == null) && !(steamPlayer.player.movement == null) && !(steamPlayer.player.life == null) && !steamPlayer.player.life.isDead)
         {
             if (steamPlayer.player.movement.nav == this.nav)
             {
                 for (int j = 0; j < steamPlayer.player.quests.questsList.Count; j++)
                 {
                     PlayerQuest playerQuest = steamPlayer.player.quests.questsList[j];
                     if (playerQuest != null && playerQuest.asset != null)
                     {
                         for (int k = 0; k < playerQuest.asset.conditions.Length; k++)
                         {
                             NPCZombieKillsCondition npczombieKillsCondition = playerQuest.asset.conditions[k] as NPCZombieKillsCondition;
                             if (npczombieKillsCondition != null)
                             {
                                 if (npczombieKillsCondition.nav == this.nav && npczombieKillsCondition.spawn && !npczombieKillsCondition.isConditionMet(steamPlayer.player))
                                 {
                                     Zombie zombie = null;
                                     for (int l = 0; l < this.zombies.Count; l++)
                                     {
                                         Zombie zombie2 = this.zombies[l];
                                         if (zombie2 != null && zombie2.isDead)
                                         {
                                             zombie = zombie2;
                                             break;
                                         }
                                     }
                                     if (zombie == null)
                                     {
                                         for (int m = 0; m < this.zombies.Count; m++)
                                         {
                                             Zombie zombie3 = this.zombies[m];
                                             if (zombie3 != null && !zombie3.isHunting)
                                             {
                                                 zombie = zombie3;
                                                 break;
                                             }
                                         }
                                     }
                                     if (zombie == null)
                                     {
                                         zombie = this.zombies[Random.Range(0, this.zombies.Count)];
                                     }
                                     Vector3 position = zombie.transform.position;
                                     if (zombie.isDead)
                                     {
                                         for (int n = 0; n < 10; n++)
                                         {
                                             ZombieSpawnpoint zombieSpawnpoint = LevelZombies.zombies[(int)this.nav][Random.Range(0, LevelZombies.zombies[(int)this.nav].Count)];
                                             if (SafezoneManager.checkPointValid(zombieSpawnpoint.point))
                                             {
                                                 break;
                                             }
                                             position    = zombieSpawnpoint.point;
                                             position.y += 0.1f;
                                         }
                                     }
                                     this.bossZombie = zombie;
                                     this.bossZombie.sendRevive(this.bossZombie.type, (byte)npczombieKillsCondition.zombie, this.bossZombie.shirt, this.bossZombie.pants, this.bossZombie.hat, this.bossZombie.gear, position, Random.Range(0f, 360f));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #4
0
        public static void save()
        {
            Block block = new Block();

            block.writeByte(LevelZombies.SAVEDATA_TABLE_VERSION);
            block.writeByte((byte)LevelZombies.tables.Count);
            byte b = 0;

            while ((int)b < LevelZombies.tables.Count)
            {
                ZombieTable zombieTable = LevelZombies.tables[(int)b];
                block.writeColor(zombieTable.color);
                block.writeString(zombieTable.name);
                block.writeBoolean(zombieTable.isMega);
                block.writeUInt16(zombieTable.health);
                block.writeByte(zombieTable.damage);
                block.writeByte(zombieTable.lootIndex);
                block.writeUInt16(zombieTable.lootID);
                block.writeUInt32(zombieTable.xp);
                block.writeSingle(zombieTable.regen);
                block.writeString(zombieTable.difficultyGUID);
                block.write((byte)zombieTable.slots.Length);
                byte b2 = 0;
                while ((int)b2 < zombieTable.slots.Length)
                {
                    ZombieSlot zombieSlot = zombieTable.slots[(int)b2];
                    block.writeSingle(zombieSlot.chance);
                    block.writeByte((byte)zombieSlot.table.Count);
                    byte b3 = 0;
                    while ((int)b3 < zombieSlot.table.Count)
                    {
                        ZombieCloth zombieCloth = zombieSlot.table[(int)b3];
                        block.writeUInt16(zombieCloth.item);
                        b3 += 1;
                    }
                    b2 += 1;
                }
                b += 1;
            }
            ReadWrite.writeBlock(Level.info.path + "/Spawns/Zombies.dat", false, false, block);
            River river = new River(Level.info.path + "/Spawns/Animals.dat", false);

            river.writeByte(LevelZombies.SAVEDATA_SPAWN_VERSION);
            for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1)
            {
                for (byte b5 = 0; b5 < Regions.WORLD_SIZE; b5 += 1)
                {
                    List <ZombieSpawnpoint> list = LevelZombies.spawns[(int)b4, (int)b5];
                    river.writeUInt16((ushort)list.Count);
                    ushort num = 0;
                    while ((int)num < list.Count)
                    {
                        ZombieSpawnpoint zombieSpawnpoint = list[(int)num];
                        river.writeByte(zombieSpawnpoint.type);
                        river.writeSingleVector3(zombieSpawnpoint.point);
                        num += 1;
                    }
                }
            }
            river.closeRiver();
        }