private void Start()
        {
            this.started = Time.realtimeSinceStartup;
            Transform transform = base.transform.FindChild("Engine");

            if (transform != null)
            {
                transform.gameObject.SetActive(true);
            }
            if (!Provider.isServer)
            {
                return;
            }
            if (this.isRegistered)
            {
                return;
            }
            if (this.isPlant)
            {
                return;
            }
            if (!LevelNavigation.checkNavigation(base.transform.position))
            {
                return;
            }
            LevelNavigation.tryGetNavigation(base.transform.position, out this.nav);
            this.initialParticipants = BeaconManager.getParticipants(this.nav);
            BeaconManager.registerBeacon(this.nav, this);
            this.isRegistered = true;
        }
Beispiel #2
0
        // Token: 0x060023C8 RID: 9160 RVA: 0x000C6824 File Offset: 0x000C4C24
        public void bakeNavigation()
        {
            float x = Flag.MIN_SIZE + this.width * (Flag.MAX_SIZE - Flag.MIN_SIZE);
            float z = Flag.MIN_SIZE + this.height * (Flag.MAX_SIZE - Flag.MIN_SIZE);

            if (!Level.info.configData.Use_Legacy_Ground)
            {
                this.graph.forcedBoundsCenter = new Vector3(this.point.x, 0f, this.point.z);
                this.graph.forcedBoundsSize   = new Vector3(x, Landscape.TILE_HEIGHT, z);
            }
            else if (Level.info.configData.Use_Legacy_Water && LevelLighting.seaLevel < 0.99f && !Level.info.configData.Allow_Underwater_Features)
            {
                this.graph.forcedBoundsCenter = new Vector3(this.point.x, LevelLighting.seaLevel * Level.TERRAIN + (Level.TERRAIN - LevelLighting.seaLevel * Level.TERRAIN) / 2f - 0.625f, this.point.z);
                this.graph.forcedBoundsSize   = new Vector3(x, Level.TERRAIN - LevelLighting.seaLevel * Level.TERRAIN + 1.25f, z);
            }
            else
            {
                this.graph.forcedBoundsCenter = new Vector3(this.point.x, Level.TERRAIN / 2f, this.point.z);
                this.graph.forcedBoundsSize   = new Vector3(x, Level.TERRAIN, z);
            }
            if (LevelGround.models2 != null)
            {
                LevelGround.models2.gameObject.SetActive(false);
            }
            AstarPath.active.ScanSpecific(this.graph);
            LevelNavigation.updateBounds();
            if (LevelGround.models2 != null)
            {
                LevelGround.models2.gameObject.SetActive(true);
            }
        }
        // Token: 0x060033BF RID: 13247 RVA: 0x0014FA48 File Offset: 0x0014DE48
        public static void alert(Vector3 position, float radius)
        {
            float sqrRadius = radius * radius;

            if (LevelNavigation.checkNavigation(position))
            {
                AlertTool.zombiesInRadius.Clear();
                ZombieManager.getZombiesInRadius(position, sqrRadius, AlertTool.zombiesInRadius);
                for (int i = 0; i < AlertTool.zombiesInRadius.Count; i++)
                {
                    Zombie zombie = AlertTool.zombiesInRadius[i];
                    if (!zombie.isDead)
                    {
                        zombie.alert(position, true);
                    }
                }
            }
            AlertTool.animalsInRadius.Clear();
            AnimalManager.getAnimalsInRadius(position, sqrRadius, AlertTool.animalsInRadius);
            for (int j = 0; j < AlertTool.animalsInRadius.Count; j++)
            {
                Animal animal = AlertTool.animalsInRadius[j];
                if (!animal.isDead)
                {
                    if (animal.asset != null)
                    {
                        if (animal.asset.behaviour != EAnimalBehaviour.IGNORE)
                        {
                            animal.alertPoint(position, true);
                        }
                    }
                }
            }
        }
        // Token: 0x060026A8 RID: 9896 RVA: 0x000E4ED4 File Offset: 0x000E32D4
        private void OnEnable()
        {
            if (!Provider.isServer)
            {
                return;
            }
            if (!this.isListeningPlayer)
            {
                PlayerLife.onPlayerLifeUpdated = (PlayerLifeUpdated)Delegate.Combine(PlayerLife.onPlayerLifeUpdated, new PlayerLifeUpdated(this.onPlayerLifeUpdated));
                this.isListeningPlayer         = true;
            }
            if (this.region != null)
            {
                return;
            }
            byte b;

            if (LevelNavigation.tryGetBounds(base.transform.position, out b))
            {
                this.region = ZombieManager.regions[(int)b];
            }
            if (this.region == null)
            {
                return;
            }
            if (!this.isListeningZombie)
            {
                ZombieRegion zombieRegion = this.region;
                zombieRegion.onZombieLifeUpdated = (ZombieLifeUpdated)Delegate.Combine(zombieRegion.onZombieLifeUpdated, new ZombieLifeUpdated(this.onZombieLifeUpdated));
                this.isListeningZombie           = true;
            }
        }
Beispiel #5
0
        private void Update()
        {
            byte b;
            byte b2;

            if (Regions.tryGetCoordinate(base.transform.position, out b, out b2) && (b != this.region_x || b2 != this.region_y))
            {
                byte region_x = this.region_x;
                byte region_y = this.region_y;
                this._region_x = b;
                this._region_y = b2;
                if (this.onRegionUpdated != null)
                {
                    this.onRegionUpdated(region_x, region_y, b, b2);
                }
            }
            byte b3;

            LevelNavigation.tryGetBounds(base.transform.position, out b3);
            if (b3 != this.bound)
            {
                byte bound = this.bound;
                this._bound = b3;
                if (this.onBoundUpdated != null)
                {
                    this.onBoundUpdated(bound, b3);
                }
            }
            this.effectNode = null;
            for (int i = 0; i < LevelNodes.nodes.Count; i++)
            {
                Node node = LevelNodes.nodes[i];
                if (node.type == ENodeType.EFFECT)
                {
                    EffectNode effectNode = (EffectNode)node;
                    if (effectNode.shape == ENodeShape.SPHERE)
                    {
                        if ((base.transform.position - effectNode.point).sqrMagnitude < effectNode.editorRadius)
                        {
                            this.effectNode = effectNode;
                            break;
                        }
                    }
                    else if (effectNode.shape == ENodeShape.BOX && Mathf.Abs(base.transform.position.x - effectNode.point.x) < effectNode.bounds.x && Mathf.Abs(base.transform.position.y - effectNode.point.y) < effectNode.bounds.y && Mathf.Abs(base.transform.position.z - effectNode.point.z) < effectNode.bounds.z)
                    {
                        this.effectNode = effectNode;
                        break;
                    }
                }
            }
            AmbianceVolume effectNode2;

            if (this.effectNode == null && AmbianceUtility.isPointInsideVolume(base.transform.position, out effectNode2))
            {
                this.effectNode = effectNode2;
            }
            LevelLighting.updateLocal(MainCamera.instance.transform.position, 0f, this.effectNode);
        }
Beispiel #6
0
        public static Transform addFlag(Vector3 point)
        {
            RecastGraph newGraph = LevelNavigation.addGraph();
            FlagData    flagData = new FlagData(string.Empty, 64, true);

            LevelNavigation.flags.Add(new Flag(point, newGraph, flagData));
            LevelNavigation.flagData.Add(flagData);
            return(LevelNavigation.flags[LevelNavigation.flags.Count - 1].model);
        }
Beispiel #7
0
 // Token: 0x060027A2 RID: 10146 RVA: 0x000F09E2 File Offset: 0x000EEDE2
 public static void deregisterBeacon(byte nav, InteractableBeacon beacon)
 {
     if (!LevelNavigation.checkSafe(nav))
     {
         return;
     }
     BeaconManager.beacons[(int)nav].Remove(beacon);
     if (BeaconManager.onBeaconUpdated != null)
     {
         BeaconManager.onBeaconUpdated(nav, BeaconManager.beacons[(int)nav].Count > 0);
     }
 }
Beispiel #8
0
		public static void save()
		{
			LevelObjects.save();
			LevelLighting.save();
			LevelGround.save();
			LevelRoads.save();
			if (!Level.isVR)
			{
				LevelNavigation.save();
				LevelNodes.save();
				LevelItems.save();
				LevelPlayers.save();
				LevelZombies.save();
				LevelVehicles.save();
				LevelAnimals.save();
				LevelVisibility.save();
			}
			Editor.save();
		}
 // Token: 0x06001ECB RID: 7883 RVA: 0x000A8534 File Offset: 0x000A6934
 private static void select(Transform select)
 {
     if (EditorNavigation.selection != null)
     {
         EditorNavigation.selection.GetComponent <Renderer>().material.color = Color.white;
     }
     if (EditorNavigation.selection == select || select == null)
     {
         EditorNavigation.selection = null;
         EditorNavigation._flag     = null;
     }
     else
     {
         EditorNavigation.selection = select;
         EditorNavigation._flag     = LevelNavigation.getFlag(EditorNavigation.selection);
         EditorNavigation.selection.GetComponent <Renderer>().material.color = Color.red;
     }
     EditorEnvironmentNavigationUI.updateSelection(EditorNavigation.flag);
 }
 // Token: 0x06001ECC RID: 7884 RVA: 0x000A85D0 File Offset: 0x000A69D0
 private void Update()
 {
     if (!EditorNavigation.isPathfinding)
     {
         return;
     }
     if (!EditorInteract.isFlying && GUIUtility.hotControl == 0)
     {
         if (EditorInteract.worldHit.transform != null)
         {
             EditorNavigation.marker.position = EditorInteract.worldHit.point;
         }
         if ((Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.Backspace)) && EditorNavigation.selection != null)
         {
             LevelNavigation.removeFlag(EditorNavigation.selection);
         }
         if (Input.GetKeyDown(ControlsSettings.tool_2) && EditorInteract.worldHit.transform != null && EditorNavigation.selection != null)
         {
             Vector3 point = EditorInteract.worldHit.point;
             EditorNavigation.flag.move(point);
         }
         if (Input.GetKeyDown(ControlsSettings.primary))
         {
             if (EditorInteract.logicHit.transform != null)
             {
                 if (EditorInteract.logicHit.transform.name == "Flag")
                 {
                     EditorNavigation.select(EditorInteract.logicHit.transform);
                 }
             }
             else if (EditorInteract.worldHit.transform != null)
             {
                 Vector3 point2 = EditorInteract.worldHit.point;
                 EditorNavigation.select(LevelNavigation.addFlag(point2));
             }
         }
     }
 }
Beispiel #11
0
 public static void removeFlag(Transform select)
 {
     for (int i = 0; i < LevelNavigation.flags.Count; i++)
     {
         if (LevelNavigation.flags[i].model == select)
         {
             for (int j = i + 1; j < LevelNavigation.flags.Count; j++)
             {
                 LevelNavigation.flags[j].needsNavigationSave = true;
             }
             try
             {
                 LevelNavigation.flags[i].remove();
             }
             catch
             {
             }
             LevelNavigation.flags.RemoveAt(i);
             LevelNavigation.flagData.RemoveAt(i);
             break;
         }
     }
     LevelNavigation.updateBounds();
 }
Beispiel #12
0
        private static RecastGraph buildGraph(River river)
        {
            RecastGraph recastGraph = LevelNavigation.addGraph();
            int         graphIndex  = AstarPath.active.astarData.GetGraphIndex(recastGraph);

            TriangleMeshNode.SetNavmeshHolder(graphIndex, recastGraph);
            recastGraph.forcedBoundsCenter = river.readSingleVector3();
            recastGraph.forcedBoundsSize   = river.readSingleVector3();
            recastGraph.tileXCount         = (int)river.readByte();
            recastGraph.tileZCount         = (int)river.readByte();
            RecastGraph.NavmeshTile[] array = new RecastGraph.NavmeshTile[recastGraph.tileXCount * recastGraph.tileZCount];
            recastGraph.SetTiles(array);
            for (int i = 0; i < recastGraph.tileZCount; i++)
            {
                for (int j = 0; j < recastGraph.tileXCount; j++)
                {
                    RecastGraph.NavmeshTile navmeshTile = new RecastGraph.NavmeshTile();
                    navmeshTile.x      = j;
                    navmeshTile.z      = i;
                    navmeshTile.w      = 1;
                    navmeshTile.d      = 1;
                    navmeshTile.bbTree = new BBTree(navmeshTile);
                    int num = j + i * recastGraph.tileXCount;
                    array[num]       = navmeshTile;
                    navmeshTile.tris = new int[(int)river.readUInt16()];
                    for (int k = 0; k < navmeshTile.tris.Length; k++)
                    {
                        navmeshTile.tris[k] = (int)river.readUInt16();
                    }
                    navmeshTile.verts = new Int3[(int)river.readUInt16()];
                    for (int l = 0; l < navmeshTile.verts.Length; l++)
                    {
                        navmeshTile.verts[l] = new Int3(river.readInt32(), river.readInt32(), river.readInt32());
                    }
                    navmeshTile.nodes = new TriangleMeshNode[navmeshTile.tris.Length / 3];
                    num <<= 12;
                    for (int m = 0; m < navmeshTile.nodes.Length; m++)
                    {
                        navmeshTile.nodes[m] = new TriangleMeshNode(AstarPath.active);
                        TriangleMeshNode triangleMeshNode = navmeshTile.nodes[m];
                        triangleMeshNode.GraphIndex = (uint)graphIndex;
                        triangleMeshNode.Penalty    = 0u;
                        triangleMeshNode.Walkable   = true;
                        triangleMeshNode.v0         = (navmeshTile.tris[m * 3] | num);
                        triangleMeshNode.v1         = (navmeshTile.tris[m * 3 + 1] | num);
                        triangleMeshNode.v2         = (navmeshTile.tris[m * 3 + 2] | num);
                        triangleMeshNode.UpdatePositionFromVertices();
                        navmeshTile.bbTree.Insert(triangleMeshNode);
                    }
                    recastGraph.CreateNodeConnections(navmeshTile.nodes);
                }
            }
            for (int n = 0; n < recastGraph.tileZCount; n++)
            {
                for (int num2 = 0; num2 < recastGraph.tileXCount; num2++)
                {
                    RecastGraph.NavmeshTile tile = array[num2 + n * recastGraph.tileXCount];
                    recastGraph.ConnectTileWithNeighbours(tile);
                }
            }
            return(recastGraph);
        }
Beispiel #13
0
 public static void load()
 {
     LevelNavigation._models                 = new GameObject().transform;
     LevelNavigation.models.name             = "Navigation";
     LevelNavigation.models.parent           = Level.level;
     LevelNavigation.models.tag              = "Logic";
     LevelNavigation.models.gameObject.layer = LayerMasks.LOGIC;
     LevelNavigation._bounds                 = new List <Bounds>();
     LevelNavigation.flagData                = new List <FlagData>();
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Bounds.dat", false, false))
     {
         River river = new River(Level.info.path + "/Environment/Bounds.dat", false);
         byte  b     = river.readByte();
         if (b > 0)
         {
             byte b2 = river.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 Vector3 vector  = river.readSingleVector3();
                 Vector3 vector2 = river.readSingleVector3();
                 LevelNavigation.bounds.Add(new Bounds(vector, vector2));
             }
         }
         river.closeRiver();
     }
     if (ReadWrite.fileExists(Level.info.path + "/Environment/Flags_Data.dat", false, false))
     {
         River river2 = new River(Level.info.path + "/Environment/Flags_Data.dat", false);
         byte  b4     = river2.readByte();
         if (b4 > 0)
         {
             byte b5 = river2.readByte();
             for (byte b6 = 0; b6 < b5; b6 += 1)
             {
                 string newDifficultyGUID = river2.readString();
                 byte   newMaxZombies     = 64;
                 if (b4 > 1)
                 {
                     newMaxZombies = river2.readByte();
                 }
                 bool newSpawnZombies = true;
                 if (b4 > 2)
                 {
                     newSpawnZombies = river2.readBoolean();
                 }
                 LevelNavigation.flagData.Add(new FlagData(newDifficultyGUID, newMaxZombies, newSpawnZombies));
             }
         }
         river2.closeRiver();
     }
     if (LevelNavigation.flagData.Count < LevelNavigation.bounds.Count)
     {
         for (int i = LevelNavigation.flagData.Count; i < LevelNavigation.bounds.Count; i++)
         {
             LevelNavigation.flagData.Add(new FlagData(string.Empty, 64, true));
         }
     }
     if (Level.isEditor)
     {
         LevelNavigation.flags = new List <Flag>();
         Object.Destroy(AstarPath.active.GetComponent <TileHandlerHelpers>());
         if (ReadWrite.fileExists(Level.info.path + "/Environment/Flags.dat", false, false))
         {
             River river3 = new River(Level.info.path + "/Environment/Flags.dat", false);
             byte  b7     = river3.readByte();
             if (b7 > 2)
             {
                 byte b8 = river3.readByte();
                 for (byte b9 = 0; b9 < b8; b9 += 1)
                 {
                     Vector3 newPoint = river3.readSingleVector3();
                     float   num      = river3.readSingle();
                     float   num2     = river3.readSingle();
                     if (b7 < 4)
                     {
                         num  *= 0.5f;
                         num2 *= 0.5f;
                     }
                     RecastGraph recastGraph = null;
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Environment/Navigation_",
                         b9,
                         ".dat"
                     }), false, false))
                     {
                         River river4 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Environment/Navigation_",
                             b9,
                             ".dat"
                         }), false);
                         byte b10 = river4.readByte();
                         if (b10 > 0)
                         {
                             recastGraph = LevelNavigation.buildGraph(river4);
                         }
                         river4.closeRiver();
                     }
                     if (recastGraph == null)
                     {
                         recastGraph = LevelNavigation.addGraph();
                     }
                     LevelNavigation.flags.Add(new Flag(newPoint, num, num2, recastGraph, LevelNavigation.flagData[(int)b9]));
                 }
             }
             river3.closeRiver();
         }
     }
     else if (Provider.isServer)
     {
         byte b11 = 0;
         while (ReadWrite.fileExists(string.Concat(new object[]
         {
             Level.info.path,
             "/Environment/Navigation_",
             b11,
             ".dat"
         }), false, false))
         {
             River river5 = new River(string.Concat(new object[]
             {
                 Level.info.path,
                 "/Environment/Navigation_",
                 b11,
                 ".dat"
             }), false);
             byte b12 = river5.readByte();
             if (b12 > 0)
             {
                 LevelNavigation.buildGraph(river5);
             }
             river5.closeRiver();
             b11 += 1;
         }
     }
 }
Beispiel #14
0
 public static void load()
 {
     LevelZombies._models                 = new GameObject().transform;
     LevelZombies.models.name             = "Zombies";
     LevelZombies.models.parent           = Level.spawns;
     LevelZombies.models.tag              = "Logic";
     LevelZombies.models.gameObject.layer = LayerMasks.LOGIC;
     LevelZombies.tables = new List <ZombieTable>();
     if (ReadWrite.fileExists(Level.info.path + "/Spawns/Zombies.dat", false, false))
     {
         Block block = ReadWrite.readBlock(Level.info.path + "/Spawns/Zombies.dat", false, false, 0);
         byte  b     = block.readByte();
         if (b > 3 && b < 5)
         {
             block.readSteamID();
         }
         if (b > 2)
         {
             byte b2 = block.readByte();
             for (byte b3 = 0; b3 < b2; b3 += 1)
             {
                 Color  newColor     = block.readColor();
                 string newName      = block.readString();
                 bool   flag         = block.readBoolean();
                 ushort newHealth    = block.readUInt16();
                 byte   newDamage    = block.readByte();
                 byte   newLootIndex = block.readByte();
                 ushort newLootID;
                 if (b > 6)
                 {
                     newLootID = block.readUInt16();
                 }
                 else
                 {
                     newLootID = 0;
                 }
                 uint newXP;
                 if (b > 7)
                 {
                     newXP = block.readUInt32();
                 }
                 else if (flag)
                 {
                     newXP = 40u;
                 }
                 else
                 {
                     newXP = 3u;
                 }
                 float newRegen = 10f;
                 if (b > 5)
                 {
                     newRegen = block.readSingle();
                 }
                 string newDifficultyGUID = string.Empty;
                 if (b > 8)
                 {
                     newDifficultyGUID = block.readString();
                 }
                 ZombieSlot[] array = new ZombieSlot[4];
                 byte         b4    = block.readByte();
                 for (byte b5 = 0; b5 < b4; b5 += 1)
                 {
                     List <ZombieCloth> list = new List <ZombieCloth>();
                     float newChance         = block.readSingle();
                     byte  b6 = block.readByte();
                     for (byte b7 = 0; b7 < b6; b7 += 1)
                     {
                         ushort num = block.readUInt16();
                         if ((ItemAsset)Assets.find(EAssetType.ITEM, num) != null)
                         {
                             list.Add(new ZombieCloth(num));
                         }
                     }
                     array[(int)b5] = new ZombieSlot(newChance, list);
                 }
                 LevelZombies.tables.Add(new ZombieTable(array, newColor, newName, flag, newHealth, newDamage, newLootIndex, newLootID, newXP, newRegen, newDifficultyGUID));
             }
         }
         else
         {
             byte b8 = block.readByte();
             for (byte b9 = 0; b9 < b8; b9 += 1)
             {
                 Color        newColor2     = block.readColor();
                 string       newName2      = block.readString();
                 byte         newLootIndex2 = block.readByte();
                 ZombieSlot[] array2        = new ZombieSlot[4];
                 byte         b10           = block.readByte();
                 for (byte b11 = 0; b11 < b10; b11 += 1)
                 {
                     List <ZombieCloth> list2 = new List <ZombieCloth>();
                     float newChance2         = block.readSingle();
                     byte  b12 = block.readByte();
                     for (byte b13 = 0; b13 < b12; b13 += 1)
                     {
                         ushort num2 = block.readUInt16();
                         if ((ItemAsset)Assets.find(EAssetType.ITEM, num2) != null)
                         {
                             list2.Add(new ZombieCloth(num2));
                         }
                     }
                     array2[(int)b11] = new ZombieSlot(newChance2, list2);
                 }
                 LevelZombies.tables.Add(new ZombieTable(array2, newColor2, newName2, false, 100, 15, newLootIndex2, 0, 5u, 10f, string.Empty));
             }
         }
     }
     LevelZombies._spawns = new List <ZombieSpawnpoint> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE];
     for (byte b14 = 0; b14 < Regions.WORLD_SIZE; b14 += 1)
     {
         for (byte b15 = 0; b15 < Regions.WORLD_SIZE; b15 += 1)
         {
             LevelZombies.spawns[(int)b14, (int)b15] = new List <ZombieSpawnpoint>();
         }
     }
     if (Level.isEditor)
     {
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Animals.dat", false, false))
         {
             River river = new River(Level.info.path + "/Spawns/Animals.dat", false);
             byte  b16   = river.readByte();
             if (b16 > 0)
             {
                 for (byte b17 = 0; b17 < Regions.WORLD_SIZE; b17 += 1)
                 {
                     for (byte b18 = 0; b18 < Regions.WORLD_SIZE; b18 += 1)
                     {
                         ushort num3 = river.readUInt16();
                         for (ushort num4 = 0; num4 < num3; num4 += 1)
                         {
                             byte    newType  = river.readByte();
                             Vector3 newPoint = river.readSingleVector3();
                             LevelZombies.spawns[(int)b17, (int)b18].Add(new ZombieSpawnpoint(newType, newPoint));
                         }
                     }
                 }
             }
             river.closeRiver();
         }
         else
         {
             for (byte b19 = 0; b19 < Regions.WORLD_SIZE; b19 += 1)
             {
                 for (byte b20 = 0; b20 < Regions.WORLD_SIZE; b20 += 1)
                 {
                     LevelZombies.spawns[(int)b19, (int)b20] = new List <ZombieSpawnpoint>();
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Spawns/Animals_",
                         b19,
                         "_",
                         b20,
                         ".dat"
                     }), false, false))
                     {
                         River river2 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Spawns/Animals_",
                             b19,
                             "_",
                             b20,
                             ".dat"
                         }), false);
                         byte b21 = river2.readByte();
                         if (b21 > 0)
                         {
                             ushort num5 = river2.readUInt16();
                             for (ushort num6 = 0; num6 < num5; num6 += 1)
                             {
                                 byte    newType2  = river2.readByte();
                                 Vector3 newPoint2 = river2.readSingleVector3();
                                 LevelZombies.spawns[(int)b19, (int)b20].Add(new ZombieSpawnpoint(newType2, newPoint2));
                             }
                             river2.closeRiver();
                         }
                     }
                 }
             }
         }
     }
     else if (Provider.isServer)
     {
         LevelZombies._zombies = new List <ZombieSpawnpoint> [LevelNavigation.bounds.Count];
         for (int i = 0; i < LevelZombies.zombies.Length; i++)
         {
             LevelZombies.zombies[i] = new List <ZombieSpawnpoint>();
         }
         if (ReadWrite.fileExists(Level.info.path + "/Spawns/Animals.dat", false, false))
         {
             River river3 = new River(Level.info.path + "/Spawns/Animals.dat", false);
             byte  b22    = river3.readByte();
             if (b22 > 0)
             {
                 for (byte b23 = 0; b23 < Regions.WORLD_SIZE; b23 += 1)
                 {
                     for (byte b24 = 0; b24 < Regions.WORLD_SIZE; b24 += 1)
                     {
                         ushort num7 = river3.readUInt16();
                         for (ushort num8 = 0; num8 < num7; num8 += 1)
                         {
                             byte    newType3 = river3.readByte();
                             Vector3 vector   = river3.readSingleVector3();
                             byte    b25;
                             if (LevelNavigation.tryGetBounds(vector, out b25) && LevelNavigation.checkNavigation(vector))
                             {
                                 LevelZombies.zombies[(int)b25].Add(new ZombieSpawnpoint(newType3, vector));
                             }
                         }
                     }
                 }
             }
             river3.closeRiver();
         }
         else
         {
             for (byte b26 = 0; b26 < Regions.WORLD_SIZE; b26 += 1)
             {
                 for (byte b27 = 0; b27 < Regions.WORLD_SIZE; b27 += 1)
                 {
                     if (ReadWrite.fileExists(string.Concat(new object[]
                     {
                         Level.info.path,
                         "/Spawns/Animals_",
                         b26,
                         "_",
                         b27,
                         ".dat"
                     }), false, false))
                     {
                         River river4 = new River(string.Concat(new object[]
                         {
                             Level.info.path,
                             "/Spawns/Animals_",
                             b26,
                             "_",
                             b27,
                             ".dat"
                         }), false);
                         byte b28 = river4.readByte();
                         if (b28 > 0)
                         {
                             ushort num9 = river4.readUInt16();
                             for (ushort num10 = 0; num10 < num9; num10 += 1)
                             {
                                 byte    newType4 = river4.readByte();
                                 Vector3 vector2  = river4.readSingleVector3();
                                 byte    b29;
                                 if (LevelNavigation.tryGetBounds(vector2, out b29) && LevelNavigation.checkNavigation(vector2))
                                 {
                                     LevelZombies.zombies[(int)b29].Add(new ZombieSpawnpoint(newType4, vector2));
                                 }
                             }
                             river4.closeRiver();
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #15
0
		public IEnumerator init(int id)
		{
			if (!Level.isVR)
			{
				LevelNavigation.load();
			}
			LoadingUI.updateProgress(1f / Level.STEPS);
			yield return null;
			LevelObjects.load();
			LoadingUI.updateProgress(2f / Level.STEPS);
			yield return null;
			LevelLighting.load(Level.size);
			LoadingUI.updateProgress(3f / Level.STEPS);
			yield return null;
			LevelGround.load(Level.size);
			LoadingUI.updateProgress(4f / Level.STEPS);
			yield return null;
			LevelRoads.load();
			LoadingUI.updateProgress(5f / Level.STEPS);
			yield return null;
			if (!Level.isVR)
			{
				LevelNodes.load();
				LoadingUI.updateProgress(6f / Level.STEPS);
				yield return null;
				LevelItems.load();
				LoadingUI.updateProgress(7f / Level.STEPS);
				yield return null;
			}
			LevelPlayers.load();
			LoadingUI.updateProgress(8f / Level.STEPS);
			yield return null;
			if (!Level.isVR)
			{
				LevelZombies.load();
				LoadingUI.updateProgress(9f / Level.STEPS);
				yield return null;
				LevelVehicles.load();
				LoadingUI.updateProgress(10f / Level.STEPS);
				yield return null;
				LevelAnimals.load();
				LoadingUI.updateProgress(11f / Level.STEPS);
				yield return null;
			}
			LevelVisibility.load();
			LoadingUI.updateProgress(12f / Level.STEPS);
			yield return null;
			if (Level.loadingSteps != null)
			{
				Level.loadingSteps();
			}
			yield return null;
			LevelBarricades.load();
			yield return null;
			LevelStructures.load();
			Level._hash = Hash.combine(new byte[][]
			{
				Level.getLevelHash(Level.info.path),
				LevelGround.hash,
				LevelLighting.hash,
				LevelObjects.hash
			});
			Physics.gravity = new Vector3(0f, Level.info.configData.Gravity, 0f);
			yield return null;
			Resources.UnloadUnusedAssets();
			GC.Collect();
			yield return null;
			Level._editing = new GameObject().transform;
			Level.editing.name = "Editing";
			Level.editing.parent = Level.level;
			if (Level.isEditor)
			{
				Level.mapper = ((GameObject)Object.Instantiate(Resources.Load("Edit/Mapper"))).transform;
				Level.mapper.name = "Mapper";
				Level.mapper.parent = Level.editing;
				Level.mapper.position = new Vector3(0f, 1028f, 0f);
				Level.mapper.rotation = Quaternion.Euler(90f, 0f, 0f);
				Level.mapper.GetComponent<Camera>().orthographicSize = (float)(Level.size / 2 - Level.border);
				if (Level.isDevkit)
				{
					GameObject gameObject = Object.Instantiate<GameObject>(Resources.Load<GameObject>("Edit2/Editor"));
					if (gameObject != null)
					{
						gameObject.name = "Editor";
						gameObject.transform.parent = Level.editing;
					}
				}
				else
				{
					Transform transform = ((GameObject)Object.Instantiate(Resources.Load((!Level.isVR) ? "Edit/Editor" : "Edit/VR"))).transform;
					transform.name = "Editor";
					transform.parent = Level.editing;
					transform.tag = "Logic";
					transform.gameObject.layer = LayerMasks.LOGIC;
				}
			}
			yield return null;
			if (Level.onPrePreLevelLoaded != null)
			{
				Level.onPrePreLevelLoaded(id);
			}
			yield return null;
			if (Level.onPreLevelLoaded != null)
			{
				Level.onPreLevelLoaded(id);
			}
			yield return null;
			if (Level.onLevelLoaded != null)
			{
				Level.onLevelLoaded(id);
			}
			yield return null;
			if (Level.onPostLevelLoaded != null)
			{
				Level.onPostLevelLoaded(id);
			}
			yield return null;
			if (!Level.isEditor && Level.info != null && Level.info.hasTriggers)
			{
				Transform transform2 = null;
				string text = Level.info.name.ToLower();
				if (text != null)
				{
					if (!(text == "germany"))
					{
						if (!(text == "pei"))
						{
							if (!(text == "russia"))
							{
								if (text == "tutorial")
								{
									transform2 = ((GameObject)Object.Instantiate(Resources.Load("Level/Triggers_Tutorial"))).transform;
								}
							}
							else
							{
								transform2 = ((GameObject)Object.Instantiate(Resources.Load("Level/Triggers_Russia"))).transform;
							}
						}
						else
						{
							transform2 = ((GameObject)Object.Instantiate(Resources.Load("Level/Triggers_PEI"))).transform;
						}
					}
					else
					{
						transform2 = ((GameObject)Object.Instantiate(Resources.Load("Level/Triggers_Germany"))).transform;
					}
				}
				if (transform2 != null)
				{
					transform2.position = Vector3.zero;
					transform2.rotation = Quaternion.identity;
					transform2.name = "Triggers";
					transform2.parent = Level.clips;
				}
			}
			yield return null;
			Level._isLoaded = true;
			Level.isLoadingContent = false;
			yield break;
		}