示例#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();
 }
        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();
        }