コード例 #1
0
ファイル: TMXLevel.cs プロジェクト: swiebertjee/Elliptica
        //finds a player spawnpoint
        ////checks for all children and if there is type_spawn it returns it
        //protected Item FindPlayerSpawn()
        //{
        //    foreach (GameObject child in GetChildren())
        //    {
        //        if (child is Item)
        //        {
        //            Item scenery = child as Item;
        //            if (scenery.GetItemType() == Item.TYPE_SPAWN) return scenery;
        //        }
        //    }
        //    return null;
        //}
        //for interpreting the layers and not the object groups
        protected void InterpretLayer(string filename)
        {
            name = filename;
            Map map;
            TMXParser TMXParser = new TMXParser();
            map = TMXParser.Parse(filename);
            Layer[] layer = map.layer;

            for (int i = 0; i < layer.Length; i++)
            {
                interpretLayer(layer[i]);
            }
        }
コード例 #2
0
ファイル: TMXLevel.cs プロジェクト: swiebertjee/Elliptica
 //this is for interpreting only an object groups there is a different method for layer
 protected void InterpretObjectGroup(string filename)
 {
     //create a TMXParser
     TMXParser tmxParser = new TMXParser();
     //parse the file 'level.tmx'
     Map map = tmxParser.Parse(filename);
     //read all object groups
     ObjectGroup[] objectGroups = map.objectGroup;
     if(objectGroups != null)
     {
         for (int i = 0; i < objectGroups.Length; i++)
         {
             interpretObjectGroup(objectGroups[i]);
         }
     }
 }
コード例 #3
0
        protected void InterpretMap(string filename)
        {
            //create a TMXParser
            TMXParser tmxParser = new TMXParser();

            //parse the file 'level.tmx'
            _map = tmxParser.Parse(filename);
            //read all object groups if not null
            ObjectGroup[] objectGroups = _map.objectGroups;
            if (objectGroups != null)
            {
                for (int i = 0; i < objectGroups.Length; i++)
                {
                    interpretObjectGroup(objectGroups[i]);
                }
            }
        }