예제 #1
0
 public void TerrainFragmentFilling(TerrainFragment terrainFragment)
 {
     for(int i=1; i<=terrainFragment.TerrainLength; i++)
     {
         if(!TryToSpawn(_obstacles, terrainFragment, i))
         {
             TryToSpawn(_bonuses, terrainFragment, i);
         }
     }
 }
예제 #2
0
 private bool TryToSpawn(SceneObjectsType _objects, TerrainFragment terrainFragment, int zPos)
 {
     SceneObjectsData _objectToSpawn = _objects.NeedToSpawn();
     if(_objectToSpawn!=null)
     {
         _objects.CooldownCounter += _objects.Cooldown;
         BaseSceneObject sceneObject = _objectToSpawn.SceneObjectPool.GetObjectFromPool();
         sceneObject.transform.parent = terrainFragment.transform;
         sceneObject.transform.localPosition = new Vector3(_objectToSpawn.PossibleLineSpawn.GetRandomItem().localPosition.x,
                                                           sceneObjectsYPos,
                                                           zPos);
         terrainFragment.AddSceneObject(sceneObject, _objectToSpawn.SceneObjectPool);
         return true;
     }
     return false;
 }
예제 #3
0
 private void ReleaseTerrain(TerrainFragment terrain)
 {
     _terrainPool.ReleaseObject(terrain);
 }