DodongosQuest.World.GetSurroundingWorldIndexPositions C# (CSharp) Method

GetSurroundingWorldIndexPositions() public method

public GetSurroundingWorldIndexPositions ( Vector2 worldIndex ) : List
worldIndex Vector2
return List
        public List<Vector2> GetSurroundingWorldIndexPositions(Vector2 worldIndex)
        {
            List<Vector2> surroundingWorldIndexPositions = new List<Vector2>();

            Vector2 left = new Vector2(worldIndex.X - 1, worldIndex.Y);
            Vector2 right = new Vector2(worldIndex.X + 1, worldIndex.Y);
            Vector2 above = new Vector2(worldIndex.X, worldIndex.Y - 1);
            Vector2 below = new Vector2(worldIndex.X, worldIndex.Y + 1);

            if (IsIndexWithinBoundsOfWorld(left))
                surroundingWorldIndexPositions.Add(left);
            if (IsIndexWithinBoundsOfWorld(right))
                surroundingWorldIndexPositions.Add(right);
            if (IsIndexWithinBoundsOfWorld(above))
                surroundingWorldIndexPositions.Add(above);
            if (IsIndexWithinBoundsOfWorld(below))
                surroundingWorldIndexPositions.Add(below);
            return surroundingWorldIndexPositions;
        }