예제 #1
0
 void InitializeObstacles()
 {
     obstaclesPool = new ObjectPooler(obstaclePrefab, 10);
     for (int i = 0; i < 10; i++)
     {
         obstaclesPool.Spawn(levelPlanner.GenerateNextObstaclePosition(), Quaternion.identity);
     }
 }
예제 #2
0
 public void OnBecameInvisible()
 {
     if (gameObject.activeInHierarchy == true)
     {
         poolMember.Despawn();
         nextObstaclePosition = levelPlanner.GenerateNextObstaclePosition();
         poolMember.myPool.Spawn(nextObstaclePosition, Quaternion.identity);
     }
 }