コード例 #1
0
        private void CreateBoarders()
        {
            int      boarderWidth = 1;
            Obstacle obstacle     = new Obstacle(new Vector3(Game.LevelBuilder.Dimensions.x / 2, 1, 0), new Vector3(Game.LevelBuilder.Dimensions.x, boarderWidth, boarderWidth));

            Obstacles.Add(obstacle);
            obstacle = new Obstacle(new Vector3(Game.LevelBuilder.Dimensions.x / 2, 1, Game.LevelBuilder.Dimensions.y), new Vector3(Game.LevelBuilder.Dimensions.x, boarderWidth, boarderWidth));
            Obstacles.Add(obstacle);
            obstacle = new Obstacle(new Vector3(0, 1, Game.LevelBuilder.Dimensions.y / 2), new Vector3(boarderWidth, boarderWidth, Game.LevelBuilder.Dimensions.y));
            Obstacles.Add(obstacle);
            obstacle = new Obstacle(new Vector3(Game.LevelBuilder.Dimensions.x, 1, Game.LevelBuilder.Dimensions.y / 2), new Vector3(boarderWidth, boarderWidth, Game.LevelBuilder.Dimensions.y));
            Obstacles.Add(obstacle);
        }
コード例 #2
0
 public override void Create(List <IGameObject> avoidObjects, bool avoidSelf = true)
 {
     for (int i = 0; i < amount; i++)
     {
         Obstacle obstacle = new Obstacle(
             gridSize, minBorderMargin, minMarginBetweenObstacles,
             avoidObjects
             );
         Obstacles.Add(obstacle);
         if (avoidSelf)
         {
             avoidObjects.Add(obstacle);
         }
     }
     CreateBoarders();
 }