コード例 #1
0
ファイル: Map.cs プロジェクト: o3a/ZombieSmashersXNA4
 public int AddSeg(int l, int idx)
 {
     for (int i = 0; i < 64; i++)
     {
         if (mapSeg[l, i] == null)
         {
             mapSeg[l, i] = new MapSegment();
             mapSeg[l, i].SetDefIdx(idx);
             return i;
         }
     }
     return -1;
 }
コード例 #2
0
ファイル: Map.cs プロジェクト: jymaze/ZombieSmashersXNA4
 public int AddSeg(int l, int idx)
 {
     for (int i = 0; i < 64; i++)
     {
         if (mapSeg[l, i] == null)
         {
             mapSeg[l, i] = new MapSegment();
             mapSeg[l, i].SetDefIdx(idx);
             return(i);
         }
     }
     return(-1);
 }
コード例 #3
0
ファイル: Map.cs プロジェクト: o3a/ZombieSmashersXNA4
        public void Read()
        {
            BinaryReader file = new BinaryReader(File.Open(@"data/maps/" + path + ".zmx",
                FileMode.Open, FileAccess.Read));

            for (int i = 0; i < ledge.Length; i++)
            {
                ledge[i].TotalNodes = file.ReadInt32();
                for (int n = 0; n < ledge[i].TotalNodes; n++)
                {
                    ledge[i].Nodes[n] = new Vector2(
                        file.ReadSingle() * 2f, file.ReadSingle() * 2f);
                }
                ledge[i].Flags = file.ReadInt32();
            }
            for (int l = 0; l < 3; l++)
            {
                for (int i = 0; i < 64; i++)
                {
                    int t = file.ReadInt32();
                    if (t == -1)
                        mapSeg[l, i] = null;
                    else
                    {
                        mapSeg[l, i] = new MapSegment();
                        mapSeg[l, i].SetDefIdx(t);
                        mapSeg[l, i].SetLoc(new Vector2(
                            file.ReadSingle(),
                            file.ReadSingle()));
                    }
                }
            }
            for (int x = 0; x < 20; x++)
                for (int y = 0; y < 20; y++)
                    col[x, y] = file.ReadInt32();

            mapScript = new MapScript(this);

            for (int i = 0; i < mapScript.Lines.Length; i++)
            {
                String s = file.ReadString();
                if (s.Length > 0)
                    mapScript.Lines[i] = new MapScriptLine(s);
                else
                    mapScript.Lines[i] = null;
            }

            file.Close();

            Bucket = null;
            Fog = -1;
            water = 0f;

            for (int i = 0; i < TransitionDestination.Length; i++)
                TransitionDestination[i] = "";

            if (mapScript.GotoTag("init"))
                mapScript.IsReading = true;
        }
コード例 #4
0
ファイル: Map.cs プロジェクト: jymaze/ZombieSmashersXNA4
        public void Read()
        {
            BinaryReader file = new BinaryReader(File.Open(@"data/maps/" + path + ".zmx",
                                                           FileMode.Open, FileAccess.Read));

            for (int i = 0; i < ledge.Length; i++)
            {
                ledge[i].TotalNodes = file.ReadInt32();
                for (int n = 0; n < ledge[i].TotalNodes; n++)
                {
                    ledge[i].Nodes[n] = new Vector2(
                        file.ReadSingle() * 2f, file.ReadSingle() * 2f);
                }
                ledge[i].Flags = file.ReadInt32();
            }
            for (int l = 0; l < 3; l++)
            {
                for (int i = 0; i < 64; i++)
                {
                    int t = file.ReadInt32();
                    if (t == -1)
                    {
                        mapSeg[l, i] = null;
                    }
                    else
                    {
                        mapSeg[l, i] = new MapSegment();
                        mapSeg[l, i].SetDefIdx(t);
                        mapSeg[l, i].SetLoc(new Vector2(
                                                file.ReadSingle(),
                                                file.ReadSingle()));
                    }
                }
            }
            for (int x = 0; x < 20; x++)
            {
                for (int y = 0; y < 20; y++)
                {
                    col[x, y] = file.ReadInt32();
                }
            }



            mapScript = new MapScript(this);

            for (int i = 0; i < mapScript.Lines.Length; i++)
            {
                String s = file.ReadString();
                if (s.Length > 0)
                {
                    mapScript.Lines[i] = new MapScriptLine(s);
                }
                else
                {
                    mapScript.Lines[i] = null;
                }
            }



            file.Close();

            Bucket = null;
            Fog    = -1;
            water  = 0f;

            for (int i = 0; i < TransitionDestination.Length; i++)
            {
                TransitionDestination[i] = "";
            }

            if (mapScript.GotoTag("init"))
            {
                mapScript.IsReading = true;
            }
        }