コード例 #1
0
ファイル: Projectile.cs プロジェクト: Zeldorks/Zeldorks
        private static PhysicalVector2 GetStartingPosition(
            Physical.PosRectangle playerPosRectangle,
            Physical.Orientation.Cardinal orientation,
            Physical.Rectangle rectangle
            )
        {
            PhysicalVector2 result =
                playerPosRectangle.GetCenteredBound(orientation);

            switch (orientation)
            {
            case Physical.Orientation.Cardinal.Left:
                result.X -= (rectangle.Width / 2);
                break;

            case Physical.Orientation.Cardinal.Right:
                result.X += (rectangle.Width / 2);
                break;

            case Physical.Orientation.Cardinal.Up:
                result.Y -= (rectangle.Height / 2);
                break;

            case Physical.Orientation.Cardinal.Down:
                result.Y += (rectangle.Height / 2);
                break;
            }

            return(result);
        }
コード例 #2
0
ファイル: Autonomous.cs プロジェクト: Zeldorks/Zeldorks
 private static void ChangeVelocity(
     Comps.Velocity velocity,
     Orientation.Cardinal direction,
     float moveSpeed
     )
 {
     velocity.data  = direction.GetPhysicalVector2() * moveSpeed;
     velocity.decay = 1;
 }