public new void Update(GameTime gameTime, OWPlayer player) { base.Update(gameTime, player); if (movement.trigger == Movement.Trigger.AUTO) { RunEventCommand(script, player); } if (movement.trigger == Movement.Trigger.TOUCH) { bool touching = (player.travel.X == 0 && player.travel.Y == 0 && player.GetMapPos()[Character.Z] == mapZ && ( (player.GetDir() == Tile.Direction.NORTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY - 1) || (player.GetDir() == Tile.Direction.SOUTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY + 1) || (player.GetDir() == Tile.Direction.EAST && player.GetMapPos()[Character.X] == mapX - 1 && player.GetMapPos()[Character.Y] == mapY) || (player.GetDir() == Tile.Direction.WEST && player.GetMapPos()[Character.X] == mapX + 1 && player.GetMapPos()[Character.Y] == mapY))); if (!touching) { touching = false; } if (touching && !touched) { touched = true; RunEventCommand(script, player); } } if (!Global.action.dialog.visible) { sentRun = false; } if (!sentRun) { UpdateMovement(gameTime); } }
public override void Trigger(OWPlayer player) { if (movement.trigger == Movement.Trigger.ACTION) { RunEventCommand(script, player); } }
public void Update(GameTime gameTime, OWPlayer player) { foreach (EventPage p in pages) { p.Update(gameTime, player); } }
public override void Update(GameTime gameTime, OWPlayer player) { UpdateMotion(gameTime); UpdateVerts(gameTime); if (animation != null) { int frameNum = animation.sceneIndex; animation.Update(gameTime); UpdateUVCoords(); } }
public override void Update(GameTime gameTime, OWPlayer player) { UpdateTrigger(player); float old = percentOpen; UpdateMotion(gameTime); if (old != percentOpen) { UpdateVerts(gameTime); } }
public void RunEventCommand(EventCommands commands, OWPlayer player) { if (movement.turnable){ if (player.GetDir() == Tile.Direction.NORTH) SetDir(Tile.Direction.SOUTH); else if (player.GetDir() == Tile.Direction.SOUTH) SetDir(Tile.Direction.NORTH); else if (player.GetDir() == Tile.Direction.EAST) SetDir(Tile.Direction.WEST); else if (player.GetDir() == Tile.Direction.WEST) SetDir(Tile.Direction.EAST); } sentRun = true; commands(player); }
public void UpdateTrigger(OWPlayer player) { if (player.GetMapPos()[Character.Z] == mapZ && (((dir == Tile.Direction.NORTH || dir == Tile.Direction.SOUTH) && player.GetMapPos()[Character.X] == mapX) || (dir == Tile.Direction.WEST && player.GetMapPos()[Character.X] + 1 == mapX) || (dir == Tile.Direction.EAST && player.GetMapPos()[Character.X] - 1 == mapX)) && (((dir == Tile.Direction.WEST || dir == Tile.Direction.EAST) && player.GetMapPos()[Character.Y] == mapY) || (dir == Tile.Direction.NORTH && player.GetMapPos()[Character.Y] - 1 == mapY) || (dir == Tile.Direction.SOUTH && player.GetMapPos()[Character.Y] + 1 == mapY))) { state = 1; } else { state = -1; } if (player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ && ((player.GetDir() == Tile.Direction.NORTH && dir == Tile.Direction.SOUTH) || (player.GetDir() == Tile.Direction.SOUTH && dir == Tile.Direction.NORTH) || (player.GetDir() == Tile.Direction.EAST && dir == Tile.Direction.WEST) || (player.GetDir() == Tile.Direction.WEST && dir == Tile.Direction.EAST))) { state = -1; Global.action.SetTileMap(mapDestKey, destPos, (playerDir != Tile.Direction.NONE)?playerDir:player.GetDir()); player.Move(playerDir); } if (player.GetDir() == dir && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ) { state = 1; } }
public void RunEventCommand(EventCommands commands, OWPlayer player) { if (movement.turnable) { if (player.GetDir() == Tile.Direction.NORTH) { SetDir(Tile.Direction.SOUTH); } else if (player.GetDir() == Tile.Direction.SOUTH) { SetDir(Tile.Direction.NORTH); } else if (player.GetDir() == Tile.Direction.EAST) { SetDir(Tile.Direction.WEST); } else if (player.GetDir() == Tile.Direction.WEST) { SetDir(Tile.Direction.EAST); } } sentRun = true; commands(player); }
public override void Trigger(OWPlayer player) { }
public void UpdateTrigger(OWPlayer player) { if (player.GetMapPos()[Character.Z] == mapZ && (((dir == Tile.Direction.NORTH || dir == Tile.Direction.SOUTH) && player.GetMapPos()[Character.X] == mapX) || (dir == Tile.Direction.WEST && player.GetMapPos()[Character.X] + 1 == mapX) || (dir == Tile.Direction.EAST && player.GetMapPos()[Character.X] - 1 == mapX)) && (((dir == Tile.Direction.WEST || dir == Tile.Direction.EAST) && player.GetMapPos()[Character.Y] == mapY) || (dir == Tile.Direction.NORTH && player.GetMapPos()[Character.Y] - 1 == mapY) || (dir == Tile.Direction.SOUTH && player.GetMapPos()[Character.Y] + 1 == mapY))) { state = 1; }else{ state = -1; } if (player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ && ((player.GetDir() == Tile.Direction.NORTH && dir == Tile.Direction.SOUTH) || (player.GetDir() == Tile.Direction.SOUTH && dir == Tile.Direction.NORTH) || (player.GetDir() == Tile.Direction.EAST && dir == Tile.Direction.WEST) || (player.GetDir() == Tile.Direction.WEST && dir == Tile.Direction.EAST))) { state = -1; Global.action.SetTileMap(mapDestKey, destPos, (playerDir != Tile.Direction.NONE)?playerDir:player.GetDir()); player.Move(playerDir); } if (player.GetDir() == dir && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY && player.GetMapPos()[Character.Z] == mapZ) { state = 1; } }
public override void Update(GameTime gameTime, OWPlayer player) { UpdateTrigger(player); float old = percentOpen; UpdateMotion(gameTime); if(old != percentOpen) UpdateVerts(gameTime); }
public new void Update(GameTime gameTime, OWPlayer player) { base.Update(gameTime, player); if (movement.trigger == Movement.Trigger.AUTO){ RunEventCommand(script, player); } if (movement.trigger == Movement.Trigger.TOUCH){ bool touching = (player.travel.X == 0 && player.travel.Y == 0 && player.GetMapPos()[Character.Z] == mapZ && ( (player.GetDir() == Tile.Direction.NORTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY - 1) || (player.GetDir() == Tile.Direction.SOUTH && player.GetMapPos()[Character.X] == mapX && player.GetMapPos()[Character.Y] == mapY + 1) || (player.GetDir() == Tile.Direction.EAST && player.GetMapPos()[Character.X] == mapX - 1 && player.GetMapPos()[Character.Y] == mapY) || (player.GetDir() == Tile.Direction.WEST && player.GetMapPos()[Character.X] == mapX + 1 && player.GetMapPos()[Character.Y] == mapY))); if (!touching) touching = false; if (touching && !touched){ touched = true; RunEventCommand(script, player); } } if (!Global.action.dialog.visible) sentRun = false; if(!sentRun) UpdateMovement(gameTime); }
public override void Trigger(OWPlayer player) { if (movement.trigger == Movement.Trigger.ACTION){ RunEventCommand(script, player); } }
private TileMap ParseFile(HashSet <string> input) { Tile[, ,] tiles; IEvent[,,] events; Building[] buildings; ScriptedEvent[, ,] se; string mapName, line; int mapL, mapW, mapH, numNonNull, numEvents, numBuildings, buildingNum = 0; line = input.ElementAt(0); line = line.Substring(line.IndexOf('(') + 1).Trim(); mapName = line.Substring(0, line.IndexOf(',')); line = line.Substring(line.IndexOf('[') + 1).Trim(); mapL = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapW = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapH = System.Convert.ToInt32(line.Substring(0, line.IndexOf(']'))); line = line.Substring(line.IndexOf(',') + 1).Trim(); numNonNull = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); numEvents = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); numBuildings = System.Convert.ToInt32(line.Substring(0, line.IndexOf(')'))); tiles = new Tile[mapL, mapW, mapH]; events = new IEvent[mapL, mapW, mapH]; buildings = new Building[numBuildings]; se = ScriptInvoke.GetScriptedEvents(mapName, new int[3] { events.GetLength(0), events.GetLength(1), events.GetLength(2) }); numEvents += ScriptInvoke.GetNumEvents(mapName); //Basic Data down! for (int i = 1; i < input.Count; i++) { line = input.ElementAt(i).Trim(); if (line[0] == 'T') { int[] arrayPos = new int[3]; int[] mapPos = new int[3]; Tile.TileStyle style = Tile.TileStyle.FLAT; Tile.Direction dir, secondDir; line = line.Substring(line.IndexOf('[') + 1).Trim(); arrayPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); arrayPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); arrayPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(']')).Trim()); line = line.Substring(line.IndexOf('(') + 1).Trim(); style = (Tile.TileStyle)Enum.Parse(typeof(Tile.TileStyle), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); if (line.IndexOf(',') == -1) { tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, null, null); } else { line = line.Substring(line.IndexOf(',') + 1).Trim(); if (line.IndexOf(',') == -1) { dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(')')).Trim(), true); tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, dir, null); } else { dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf(',') + 1).Trim(); if (line.IndexOf(',') == -1) { secondDir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(')')).Trim(), true); tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, dir, secondDir); } else { secondDir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf('{') + 1).Trim(); bool[] passage = new bool[4]; passage[0] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); passage[1] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); passage[2] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); passage[3] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf('}')).Trim()); if (line.IndexOf(',') == -1) { tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, dir, secondDir ); tiles[arrayPos[0], arrayPos[1], arrayPos[2]].passage = passage; } else { line = line.Substring(line.IndexOf('\'')).Trim(); string tPath = line.Substring(0, line.IndexOf('\'')).Trim(); tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, tPath, mapPos, passage, dir, secondDir ); } } } } } else if (line[0] == 'C') { //make me a character! string texturePath = ""; int[] mapPos = new int[3]; Tile.Direction dir; line = line.Substring(line.IndexOf('\'') + 1).Trim(); texturePath = line.Substring(0, line.IndexOf('\'')).Trim(); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(')')).Trim(), true); events[mapPos[0], mapPos[1], mapPos[2]] = new OWPlayer(texturePath, mapPos, dir); } else if (line[0] == 'S' && line[1] == 'D') { //make me a sliding door! //SD('Images/Events/slidingDoor',{3,2,0},SOUTH,[],'stairMap'); string texturePath = ""; int[] mapPos = new int[3]; int[] destPos = new int[3]; Tile.Direction dir, playerDir; bool givenSect; Rectangle section = new Rectangle(0, 0, 0, 0); string mapDestKey = ""; line = line.Substring(line.IndexOf('\'') + 1).Trim(); texturePath = line.Substring(0, line.IndexOf('\'')).Trim(); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); line = line.Substring(line.IndexOf('{') + 1).Trim(); destPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); destPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); destPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf(',') + 1).Trim(); playerDir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf('[') + 1).Trim(); givenSect = (line[0] != ']'); if (givenSect) { float x = System.Convert.ToSingle(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); float y = System.Convert.ToSingle(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); float w = System.Convert.ToSingle(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); float h = System.Convert.ToSingle(line.Substring(0, line.IndexOf(']')).Trim()); section = new Rectangle((int)x, (int)y, (int)w, (int)h); } line = line.Substring(line.IndexOf('\'') + 1).Trim(); mapDestKey = line.Substring(0, line.IndexOf('\'')).Trim(); if (givenSect) { events[mapPos[0], mapPos[1], mapPos[2]] = new SlidingDoor(texturePath, mapPos, destPos, dir, playerDir, section, mapDestKey); } else { events[mapPos[0], mapPos[1], mapPos[2]] = new SlidingDoor(texturePath, mapPos, destPos, dir, playerDir, mapDestKey); } } else if (line[0] == 'B') { //make me a building //"B(Block264Tex,{5,6,0});"+ Name name; int[] mapPos = new int[3]; line = line.Substring(line.IndexOf('(') + 1).Trim(); string str = line.Substring(0, line.IndexOf(',')).Trim(); name = (Name)Enum.Parse(typeof(Name), str, true); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); buildings[buildingNum] = new Building(name, mapPos); buildingNum++; } } for (int i = 0; i < se.GetLength(0); i++) { for (int j = 0; j < se.GetLength(1); j++) { for (int k = 0; k < se.GetLength(2); k++) { if (se[i, j, k] != null) { events[i, j, k] = se[i, j, k]; } } } } return(new TileMap(mapName, tiles, events, buildings, numNonNull, numEvents)); }
public void Trigger(OWPlayer player) { page.Trigger(player); }
public override void Update(GameTime gameTime, OWPlayer player) { UpdateMotion(gameTime); UpdateVerts(gameTime); if (animation != null){ int frameNum = animation.sceneIndex; animation.Update(gameTime); UpdateUVCoords(); } }
private TileMap ParseFile(HashSet<string> input) { Tile[, ,] tiles; IEvent[,,] events; Building[] buildings; ScriptedEvent[, ,] se; string mapName, line; int mapL, mapW, mapH, numNonNull, numEvents, numBuildings, buildingNum = 0; line = input.ElementAt(0); line = line.Substring(line.IndexOf('(') + 1).Trim(); mapName = line.Substring(0, line.IndexOf(',')); line = line.Substring(line.IndexOf('[') + 1).Trim(); mapL = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapW = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapH = System.Convert.ToInt32(line.Substring(0, line.IndexOf(']'))); line = line.Substring(line.IndexOf(',') + 1).Trim(); numNonNull = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); numEvents = System.Convert.ToInt32(line.Substring(0, line.IndexOf(','))); line = line.Substring(line.IndexOf(',') + 1).Trim(); numBuildings = System.Convert.ToInt32(line.Substring(0, line.IndexOf(')'))); tiles = new Tile[mapL, mapW, mapH]; events = new IEvent[mapL, mapW, mapH]; buildings = new Building[numBuildings]; se = ScriptInvoke.GetScriptedEvents(mapName, new int[3] { events.GetLength(0), events.GetLength(1), events.GetLength(2) }); numEvents += ScriptInvoke.GetNumEvents(mapName); //Basic Data down! for (int i = 1; i < input.Count; i++){ line = input.ElementAt(i).Trim(); if (line[0] == 'T'){ int[] arrayPos = new int[3]; int[] mapPos = new int[3]; Tile.TileStyle style = Tile.TileStyle.FLAT; Tile.Direction dir, secondDir; line = line.Substring(line.IndexOf('[') + 1).Trim(); arrayPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); arrayPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); arrayPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(']')).Trim()); line = line.Substring(line.IndexOf('(') + 1).Trim(); style = (Tile.TileStyle)Enum.Parse(typeof(Tile.TileStyle), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); if (line.IndexOf(',') == -1){ tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, null, null); }else{ line = line.Substring(line.IndexOf(',') + 1).Trim(); if (line.IndexOf(',') == -1){ dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(')')).Trim(), true); tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, dir, null); }else{ dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf(',') + 1).Trim(); if (line.IndexOf(',') == -1){ secondDir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(')')).Trim(), true); tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, dir, secondDir); }else{ secondDir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf('{') + 1).Trim(); bool[] passage = new bool[4]; passage[0] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); passage[1] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); passage[2] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); passage[3] = System.Convert.ToBoolean(line.Substring(0, line.IndexOf('}')).Trim()); if(line.IndexOf(',') == -1){ tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, mapPos, dir, secondDir ); tiles[arrayPos[0], arrayPos[1], arrayPos[2]].passage = passage; }else{ line = line.Substring(line.IndexOf('\'')).Trim(); string tPath = line.Substring(0, line.IndexOf('\'')).Trim(); tiles[arrayPos[0], arrayPos[1], arrayPos[2]] = new Tile( style, tPath, mapPos, passage, dir, secondDir ); } } } } }else if (line[0] == 'C'){ //make me a character! string texturePath = ""; int[] mapPos = new int[3]; Tile.Direction dir; line = line.Substring(line.IndexOf('\'') + 1).Trim(); texturePath = line.Substring(0, line.IndexOf('\'')).Trim(); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(')')).Trim(), true); events[mapPos[0], mapPos[1], mapPos[2]] = new OWPlayer(texturePath, mapPos, dir); }else if (line[0] == 'S' && line[1] == 'D'){ //make me a sliding door! //SD('Images/Events/slidingDoor',{3,2,0},SOUTH,[],'stairMap'); string texturePath = ""; int[] mapPos = new int[3]; int[] destPos = new int[3]; Tile.Direction dir, playerDir; bool givenSect; Rectangle section = new Rectangle(0, 0, 0, 0); string mapDestKey = ""; line = line.Substring(line.IndexOf('\'') + 1).Trim(); texturePath = line.Substring(0, line.IndexOf('\'')).Trim(); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); line = line.Substring(line.IndexOf('{') + 1).Trim(); destPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); destPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); destPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); dir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf(',') + 1).Trim(); playerDir = (Tile.Direction)Enum.Parse(typeof(Tile.Direction), line.Substring(0, line.IndexOf(',')).Trim(), true); line = line.Substring(line.IndexOf('[') + 1).Trim(); givenSect = (line[0] != ']'); if (givenSect){ float x = System.Convert.ToSingle(line.Substring(0,line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); float y = System.Convert.ToSingle(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); float w = System.Convert.ToSingle(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); float h = System.Convert.ToSingle(line.Substring(0, line.IndexOf(']')).Trim()); section = new Rectangle((int)x, (int)y, (int)w, (int)h); } line = line.Substring(line.IndexOf('\'') + 1).Trim(); mapDestKey = line.Substring(0, line.IndexOf('\'')).Trim(); if (givenSect) events[mapPos[0], mapPos[1], mapPos[2]] = new SlidingDoor(texturePath, mapPos, destPos, dir, playerDir, section, mapDestKey); else events[mapPos[0], mapPos[1], mapPos[2]] = new SlidingDoor(texturePath, mapPos, destPos, dir, playerDir, mapDestKey); }else if (line[0] == 'B'){ //make me a building //"B(Block264Tex,{5,6,0});"+ Name name; int[] mapPos = new int[3]; line = line.Substring(line.IndexOf('(') + 1).Trim(); string str = line.Substring(0, line.IndexOf(',')).Trim(); name = (Name)Enum.Parse(typeof(Name), str, true); line = line.Substring(line.IndexOf('{') + 1).Trim(); mapPos[0] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[1] = System.Convert.ToInt32(line.Substring(0, line.IndexOf(',')).Trim()); line = line.Substring(line.IndexOf(',') + 1).Trim(); mapPos[2] = System.Convert.ToInt32(line.Substring(0, line.IndexOf('}')).Trim()); buildings[buildingNum] = new Building(name, mapPos); buildingNum++; } } for (int i = 0; i < se.GetLength(0); i++){ for (int j = 0; j < se.GetLength(1); j++){ for (int k = 0; k < se.GetLength(2); k++){ if (se[i, j, k] != null) events[i, j, k] = se[i, j, k]; } } } return new TileMap(mapName, tiles, events, buildings, numNonNull, numEvents); }
public void Update(GameTime gameTime, OWPlayer player) { foreach (EventPage p in pages){ p.Update(gameTime, player); } }