示例#1
0
文件: Map.cs 项目: MyEyes/MobaAI
        public Map(string file)
        {
            Stream stream = File.Open(basePath + file, FileMode.Open);
            BinaryReader reader = new BinaryReader(stream);
            try
            {
                sizeX = reader.ReadSingle();
                sizeY = reader.ReadSingle();
                int numBushes = reader.ReadInt32();
                bushes = new Bush[numBushes];
                for (int x = 0; x < numBushes; x++)
                    bushes[x] = new Bush(reader);

                int numCollisions = reader.ReadInt32();
                collisions = new Collision[numCollisions];
                for (int x = 0; x < numCollisions; x++)
                    collisions[x] = new Collision(reader);

                int numStructures = reader.ReadInt32();
                structures = new Structure[numStructures];
                for (int x = 0; x < numStructures; x++)
                {
                    int type = reader.ReadInt32();
                    switch ((StructureType)type)
                    {
                        case StructureType.Turret: structures[x] = new Turret(this, reader); break;
                        case StructureType.Nexus: structures[x] = new Nexus(this, reader); break;
                    }

                }

                int numLanes = reader.ReadInt32();
                lanes = new Lane[numLanes];
                for (int x = 0; x < numLanes; x++)
                    lanes[x] = new Lane(reader);
            }
            finally
            {
                reader.Close();
                stream.Close();
            }
            Initialize();
        }
示例#2
0
文件: Map.cs 项目: MyEyes/MobaAI
 public void SetCollisions(Collision[] collisions)
 {
     this.collisions = collisions;
 }