DodongosQuest.World.GetWorldIndexOneSpaceAway C# (CSharp) Method

GetWorldIndexOneSpaceAway() public method

public GetWorldIndexOneSpaceAway ( Direction direction, Vector2 startingIndex ) : Vector2
direction Direction
startingIndex Vector2
return Vector2
        public Vector2 GetWorldIndexOneSpaceAway(Direction direction, Vector2 startingIndex)
        {
            Vector2 worldIndex = new Vector2(startingIndex.X, startingIndex.Y);

            if (direction == Direction.North)
                worldIndex.Y -= 1;
            else if (direction == Direction.South)
                worldIndex.Y += 1;
            else if (direction == Direction.East)
                worldIndex.X += 1;
            else if (direction == Direction.West)
                worldIndex.X -= 1;

            return worldIndex;
        }