Ejemplo n.º 1
0
        public static DirectionCardinalG Reverse(DirectionCardinalG direction)
        {
            switch (direction)
            {
            case DirectionCardinalG.Left:
                return(DirectionCardinalG.Right);

            case DirectionCardinalG.Up:
                return(DirectionCardinalG.Down);

            case DirectionCardinalG.Right:
                return(DirectionCardinalG.Left);

            case DirectionCardinalG.Down:
                return(DirectionCardinalG.Up);

            default: return(DirectionCardinalG.Up);
            }
        }
Ejemplo n.º 2
0
        public static Vector2 DirectionToVector(DirectionCardinalG cardinal)
        {
            switch (cardinal)
            {
            case DirectionCardinalG.Left:
                return(new Vector2(-1, 0));

            case DirectionCardinalG.Up:
                return(new Vector2(0, -1));

            case DirectionCardinalG.Right:
                return(new Vector2(1, 0));

            case DirectionCardinalG.Down:
                return(new Vector2(0, 1));

            default:
                return(new Vector2(0, 0));
            }
        }