コード例 #1
0
ファイル: TileSaveData.cs プロジェクト: smldev/smlimitless
 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();
 }
コード例 #2
0
ファイル: Spiny.cs プロジェクト: smldev/smlimitless
        public override void HandleTileCollision(Tile tile, Vector2 resolutionDistance)
        {
            if (SpinyState == SpinyState.Egg && resolutionDistance.Y < 0f)
            {
                SpinyState = SpinyState.Spiny;
            }

            base.HandleTileCollision(tile, resolutionDistance);
        }
コード例 #3
0
ファイル: SimplePlayer.cs プロジェクト: smldev/smlimitless
 /// <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)
 {
 }
コード例 #4
0
ファイル: SpriteComponent.cs プロジェクト: smldev/smlimitless
 /// <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)
 {
 }
コード例 #5
0
 /// <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);
 }
コード例 #6
0
        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();
        }