コード例 #1
0
 public BallPassThroughEvent(float timeScale, Tile tile, Entity entity, BallPassThroughType type)
 {
     Tile      = tile;
     Entity    = entity;
     Type      = type;
     TimeScale = timeScale;
 }
コード例 #2
0
 public BallPassThroughEvent(
     float timeScale,
     Tile tile,
     Entity entity,
     BallPassThroughType type)
 {
     this.Tile      = tile;
     this.Entity    = entity;
     this.Type      = type;
     this.TimeScale = timeScale;
 }
コード例 #3
0
        private static bool CheckForPassThrough(
            Vector2 center,
            out BallPassThroughType type,
            out Tile contactTile)
        {
            Point tileCoordinates = center.ToTileCoordinates();
            Tile  tile            = Main.tile[tileCoordinates.X, tileCoordinates.Y];

            contactTile = tile;
            type        = BallPassThroughType.None;
            if (tile == null)
            {
                return(false);
            }
            if (tile.nactive())
            {
                type = BallPassThroughType.Tile;
                return(BallCollision.IsPositionInsideTile(center, tileCoordinates, tile));
            }
            if (tile.liquid <= (byte)0)
            {
                return(false);
            }
            float num = (float)((double)(tileCoordinates.Y + 1) * 16.0 - (double)tile.liquid / (double)byte.MaxValue * 16.0);

            switch (tile.liquidType())
            {
            case 1:
                type = BallPassThroughType.Lava;
                break;

            case 2:
                type = BallPassThroughType.Honey;
                break;

            default:
                type = BallPassThroughType.Water;
                break;
            }
            return((double)num < (double)center.Y);
        }
コード例 #4
0
        private static bool CheckForPassThrough(Vector2 center, out BallPassThroughType type, out Tile contactTile)
        {
            Point tileCoordinates = center.ToTileCoordinates();
            Tile  tile            = (contactTile = Main.tile[tileCoordinates.X, tileCoordinates.Y]);

            type = BallPassThroughType.None;
            if (tile == null)
            {
                return(false);
            }
            if (tile.nactive())
            {
                type = BallPassThroughType.Tile;
                return(IsPositionInsideTile(center, tileCoordinates, tile));
            }
            if (tile.liquid > 0)
            {
                float num = (float)(tileCoordinates.Y + 1) * 16f - (float)(int)tile.liquid / 255f * 16f;
                switch (tile.liquidType())
                {
                case 1:
                    type = BallPassThroughType.Lava;
                    break;

                case 2:
                    type = BallPassThroughType.Honey;
                    break;

                default:
                    type = BallPassThroughType.Water;
                    break;
                }
                return(num < center.Y);
            }
            return(false);
        }