public getBoundTiles ( |
||
playerBounds | ||
Результат | Vector4 |
private void DrawDebug(RoomNew room) { //if (room.player.sprite.sequence == null) // return; Rectangle titleSafeArea = GraphicsDevice.Viewport.TitleSafeArea; Vector2 hudLocation = new Vector2(titleSafeArea.X, titleSafeArea.Y); hudLocation.X = hudLocation.X + 180; hudLocation.Y = hudLocation.Y + 380; if (CONFIG_DEBUG == true) { var CurrentLvl = maze.CurrentLevel(); if (CurrentLvl != null) { DrawShadowedString(hudFont, "LEVEL NAME=" + CurrentLvl.levelIndex + "-" + CurrentLvl.levelName + "-" + maze.levelindex, hudLocation, Color.White); } hudLocation.Y = hudLocation.Y + 10; //DrawShadowedString(hudFont, "FRAME RATE=" + AnimationSequence.frameRate.ToString(), hudLocation, Color.White); //hudLocation.Y = hudLocation.Y + 10; if (maze.player != null) { int CoordX = maze.player.RoomCoord.X; int CoordY = maze.player.RoomCoord.Y; DrawShadowedString(hudFont, "ROOM NAME=" + maze.player.SpriteRoom.roomName, hudLocation, Color.White); hudLocation.Y = hudLocation.Y + 10; DrawShadowedString(hudFont, "POSTION X=" + maze.player.Position.X + " Y=" + maze.player.Position.Y + " TILE= " + maze.player.SpriteRoom.GetTile(CoordX, CoordY).Type.ToString(), hudLocation, Color.White); hudLocation.Y = hudLocation.Y + 10; Rectangle playerBound = maze.player.Position.Bounding; Rectangle tileBounds = maze.player.SpriteRoom.GetBounds(maze.player.RealPosition.X, maze.player.RealPosition.Y); Vector2 depth = RectangleExtensions.GetIntersectionDepth(playerBound, tileBounds); DrawShadowedString(hudFont, "PLAYER BOUNDS =" + "X = " + depth.X.ToString() + " Y = " + depth.Y.ToString(), hudLocation, Color.White); } hudLocation.Y = hudLocation.Y + 10; if (maze.player.sprite.sequence != null) { DrawShadowedString(hudFont, "PLAYER STATE=" + Convert.ToString(maze.player.spriteState.Value().state) + " SEQUENCE CountOffset=" + Convert.ToString(maze.player.sprite.sequence.CountOffSet), hudLocation, Color.White); } } // Get the player's bounding rectangle and find neighboring tiles. Rectangle playerBounds = maze.player.Position.Bounding; Vector4 v4 = room.getBoundTiles(playerBounds); }
public void HandleCollision() { if (this.Type == Enumeration.TileType.loose) { if (this.tileState.Value().state != Enumeration.StateTile.loosefall) { return; } Rectangle r = new Rectangle(Convert.ToInt32(Math.Truncate(Position.X)), Convert.ToInt32(Math.Truncate(Position.Y)), Tile.WIDTH, Tile.HEIGHT); Vector4 v = room.getBoundTiles(r); Rectangle tileBounds = room.GetBounds(Convert.ToInt32(Math.Truncate(v.X)), Convert.ToInt32(Math.Truncate(v.W))); Vector2 depth = RectangleExtensions.GetIntersectionDepth(tileBounds, r); Enumeration.TileType tileType = room.GetType(Convert.ToInt32(Math.Truncate(v.X)), Convert.ToInt32(Math.Truncate(v.W))); Enumeration.TileCollision tileCollision = room.GetCollision(Convert.ToInt32(Math.Truncate(v.X)), Convert.ToInt32(Math.Truncate(v.W))); //Tile tile = room.GetTile(new Vector2((int)v.X, (int)v.W)); if (tileCollision == Enumeration.TileCollision.Platform) { //if (tileType == Enumeration.TileType.floor) if (depth.Y >= Tile.HEIGHT - Tile.PERSPECTIVE) { lock (room.tilesTemporaney) { room.tilesTemporaney.Remove(this); } //Vector2 vs = new Vector2(this.Position.X, this.Position.Y); if (tileType == Enumeration.TileType.loose) { Loose l = (Loose)room.GetTile(Convert.ToInt32(Math.Truncate(v.X)), Convert.ToInt32(Math.Truncate(v.W))); l.Fall(true); } else { ((SoundEffect)Maze.dContentRes[PrinceOfPersiaGame.CONFIG_SOUNDS + "tile crashing into the floor".ToUpper()]).Play(); room.SubsTile(Coordinates, Enumeration.TileType.rubble); } } } //if (_position.Y >= RoomNew.BOTTOM_LIMIT - Tile.HEIGHT - Tile.PERSPECTIVE) if (_position.Y >= RoomNew.BOTTOM_LIMIT - Tile.PERSPECTIVE) { //remove tiles from tilesTemporaney lock (room.tilesTemporaney) { room.tilesTemporaney.Remove(this); } //exit from DOWN room RoomNew roomDown = room.maze.DownRoom(room); room = roomDown; _position.Y = RoomNew.TOP_LIMIT - 10; lock (room.tilesTemporaney) { room.tilesTemporaney.Add(this); } } } }
private void DrawDebug(RoomNew room) { //if (room.player.sprite.sequence == null) // return; Rectangle titleSafeArea = GraphicsDevice.Viewport.TitleSafeArea; Vector2 hudLocation = new Vector2(titleSafeArea.X, titleSafeArea.Y); hudLocation.X = hudLocation.X + 180; hudLocation.Y = hudLocation.Y + 380; if (CONFIG_DEBUG == false) { return; } DrawShadowedString(hudFont, "LEVEL NAME=" + maze.CurrentLevel().levelIndex + "-" + maze.CurrentLevel().levelName + "-" + maze.levelindex, hudLocation, Color.White); hudLocation.Y = hudLocation.Y + 10; //DrawShadowedString(hudFont, "FRAME RATE=" + AnimationSequence.frameRate.ToString(), hudLocation, Color.White); //hudLocation.Y = hudLocation.Y + 10; if (maze.player != null) { int CoordX = maze.player.RoomCoord.X; int CoordY = maze.player.RoomCoord.Y; DrawShadowedString(hudFont, "ROOM NAME=" + maze.player.SpriteRoom.roomName, hudLocation, Color.White); hudLocation.Y = hudLocation.Y + 10; DrawShadowedString(hudFont, "POSTION X=" + maze.player.Position.X + " Y=" + maze.player.Position.Y + " TILE= " + maze.player.SpriteRoom.GetTile(CoordX, CoordY).Type.ToString(), hudLocation, Color.White); hudLocation.Y = hudLocation.Y + 10; Rectangle playerBound = maze.player.Position.Bounding; Rectangle tileBounds = maze.player.SpriteRoom.GetBounds(maze.player.RealPosition.X, maze.player.RealPosition.Y); Vector2 depth = RectangleExtensions.GetIntersectionDepth(playerBound, tileBounds); DrawShadowedString(hudFont, "PLAYER BOUNDS =" + "X = " + depth.X.ToString() + " Y = " + depth.Y.ToString(), hudLocation, Color.White); } hudLocation.Y = hudLocation.Y + 10; if (maze.player.sprite.sequence != null) DrawShadowedString(hudFont, "PLAYER STATE=" + Convert.ToString(maze.player.spriteState.Value().state) + " SEQUENCE CountOffset=" + Convert.ToString(maze.player.sprite.sequence.CountOffSet), hudLocation, Color.White); // Get the player's bounding rectangle and find neighboring tiles. Rectangle playerBounds = maze.player.Position.Bounding; Vector4 v4 = room.getBoundTiles(playerBounds); }