Bacterium.Game.Find C# (CSharp) Method

Find() public method

public Find ( int side, int x, int y ) : MyPoint
side int
x int
y int
return MyPoint
        public MyPoint Find(int side, int x, int y)
        {
            MyPoint closest = null;
            if (side == MyPoint.LIGHT)
                for (int i = 0; i < _lightList.Count; i++)
                {
                    if (x - _lightList[i].X >= 0 && x - _lightList[i].X <= MyPoint.WIDTH &&
                        y - _lightList[i].Y >= 0 && y - _lightList[i].Y <= MyPoint.HEIGHT)
                    { closest = _lightList[i]; break; }
                }
            else if (side == MyPoint.DARK)
                for (int i = 0; i < _darkList.Count; i++)
                {
                    if (x - _darkList[i].X >= 0 && x - _darkList[i].X <= MyPoint.WIDTH &&
                        y - _darkList[i].Y >= 0 && y - _darkList[i].Y <= MyPoint.HEIGHT)
                    { closest = _darkList[i]; break; }
                }
            return closest;
        }