コード例 #1
0
ファイル: InputSystem.cs プロジェクト: Djadavin/kill-stuff
 private static Vector2I GetDirection(MoveDirection moveDirections)
 {
     var direction = new Vector2I();
     if (moveDirections.IsOptionSet(MoveDirection.Forward))
     {
         direction.Y += 1;
     }
     if (moveDirections.IsOptionSet(MoveDirection.Backward))
     {
         direction.Y -= 1;
     }
     if (moveDirections.IsOptionSet(MoveDirection.Right))
     {
         direction.X += 1;
     }
     if (moveDirections.IsOptionSet(MoveDirection.Left))
     {
         direction.X -= 1;
     }
     return direction;
 }
コード例 #2
0
    private static Vector3 GetDirection(MoveDirection moveDirections)
    {
        var direction = new Vector3();

        if (moveDirections.IsOptionSet(MoveDirection.Forward))
        {
            direction.z += 1;
        }
        else if (moveDirections.IsOptionSet(MoveDirection.Backward))
        {
            direction.z -= 1;
        }

        if (moveDirections.IsOptionSet(MoveDirection.Right))
        {
            direction.x += 1;
        }
        else if (moveDirections.IsOptionSet(MoveDirection.Left))
        {
            direction.x -= 1;
        }

        return(direction);
    }