protected void generateStartPos(Canvas c) { SingletonRandom r = SingletonRandom.getInstance(); int side = r.Next(0, 2); int dir = r.Next(0, 3); int x = r.Next(1, (int)(c.Width - _currentImage.Width)); int y = r.Next(1, (int)(c.Height - _currentImage.Height)); switch (side) { case 0: { _direction = Directions.RIGHT_DIRECTIONS[dir]; _x = 0; _y = y; break; } case 1: { _direction = Directions.LEFT_DIRECTIONS[dir]; _x = (int)(c.Width - _currentImage.Width);; _y = y; break; } } }
public static SingletonRandom getInstance() { if (instance == null) { instance = new SingletonRandom(); } return instance; }
public static SingletonRandom getInstance() { if (instance == null) { instance = new SingletonRandom(); } return(instance); }