//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]); } }
//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]); } } }
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]); } } }