Esempio n. 1
0
 public TileSaveData(Tile tile)
 {
     TypeName = tile.GetType().FullName;
     SolidSides = (tile.TileShape == CollidableShape.Rectangle) ? (int)tile.RectSolidSides : (int)tile.TriSolidSides;
     Name = tile.Name;
     GraphicsResourceName = tile.GraphicsResourceName;
     InitialState = tile.InitialState;
     CustomData = tile.GetCustomSerializableObjects();
 }
Esempio n. 2
0
        public override void HandleTileCollision(Tile tile, Vector2 resolutionDistance)
        {
            if (SpinyState == SpinyState.Egg && resolutionDistance.Y < 0f)
            {
                SpinyState = SpinyState.Spiny;
            }

            base.HandleTileCollision(tile, resolutionDistance);
        }
Esempio n. 3
0
 /// <summary>
 /// Handles a tile collision.
 /// </summary>
 /// <param name="tile">The colliding tile.</param>
 /// <param name="intersect">The depth of the collision.</param>
 public override void HandleTileCollision(Tile tile, Vector2 intersect)
 {
 }
Esempio n. 4
0
 /// <summary>
 ///   A method called when the owner sprite collides with a tile.
 /// </summary>
 /// <param name="collidingTile">
 ///   The tile that the owner sprite collided with.
 /// </param>
 /// <param name="resolutionDistance">
 ///   The distance by which the sprite was moved in order to resolve the
 ///   tile collision.
 /// </param>
 public virtual void HandleTileCollision(Tile collidingTile, Vector2 resolutionDistance)
 {
 }
 /// <summary>
 ///   Sets the <see cref="TextTileInfo" /> textbox.
 /// </summary>
 /// <param name="tile">The tile whose information to use.</param>
 public void SetTileInfo(Tile tile)
 {
     TextTileInfo.Text = GetTileInformation(tile);
 }
        private string GetTileInformation(Tile tile)
        {
            if (tile == null) { return "No tile under cursor."; }

            StringBuilder resultBuilder = new StringBuilder();
            resultBuilder.AppendLine($"Tile Type: {tile.GetType().FullName}");
            resultBuilder.Append($"Position: {tile.Position.X}, {tile.Position.Y}, Size: {tile.Size.X}, {tile.Size.Y}");
            resultBuilder.AppendLine($"Tile Shape: {tile.TileShape}");
            resultBuilder.AppendLine($"Sloped Sides: {((tile.TileShape == Physics.CollidableShape.RightTriangle) ? tile.SlopedSides.ToString() : "N/A")}");

            return resultBuilder.ToString();
        }