public override void ApplyTo(SimpleGameServer server) { while (server.GetCountByObjectName("Obstacle") < ObstaclesCount) { LoggingService.LogMessage("Spawning Obstacles."); Vector2D obstaclePosition = new Vector2D(x: random.Next(0, 60) * 32, y: random.Next(0, 32) * 32); if (!server.GetObjectAt(obstaclePosition).Any()) { GameObject apple = GameObject.Create ( objectName: "Obstacle", playable: false, isSolid: true, bitmapName: "obstacle.png", position: obstaclePosition, velocity: new Vector2D(x: 0, y: 0), roration: 0, scale: 1, objectTypeName: "Obstacle", owner: null, properties: null ); server.AddObject(apple); } else { } } }
public override void ApplyTo(SimpleGameServer server) { while (server.GetCountByObjectName("Apple") < AppleLimit) { Vector2D applePosition = new Vector2D(x: random.Next(0, 60) * 32, y: random.Next(0, 32) * 32); LoggingService.LogMessage("Spawning Apple(s)."); if (!server.GetObjectAt(applePosition).Any()) { GameObject apple = GameObject.Create ( objectName: "Test", playable: false, isSolid: false, bitmapName: "apple.png", position: applePosition, velocity: new Vector2D(x: 0, y: 0), roration: 0, scale: 1, objectTypeName: "Apple", owner: null, properties: new AppleProperties() ); server.AddObject(apple); } } }
public override void ApplyTo(SimpleGameServer server) { while (server.GetCountByObjectName("Snake") < SnakeLimit) { GameObject snake = GameObject.Create ( objectName: "SnakeHead", playable: false, isSolid: true, bitmapName: "snake.png", position: new Vector2D(x: random.Next(0, 60) * 32, y: random.Next(0, 32) * 32), velocity: new Vector2D(x: 32, y: 0), roration: 0, scale: 1, objectTypeName: "Snake", owner: null, properties: null ); snake.ObjectProperties = new SnakeProperties(snake); server.AddObject(snake); } }