예제 #1
0
        private void Fire()
        {
            ShellBase newShell = shellPool.GetInctance();

            newShell.transform.position = shellHolder.position;
            newShell.transform.forward  = shellHolder.transform.forward;
            newShell.gameObject.SetActive(true);
            newShell.Fire();
        }
예제 #2
0
 public override void Enable()
 {
     for (int i = 0; i < Random.Range(collectablesData.MinCollectablePerPlatform, collectablesData.MaxCollectablePerPlatform); i++)
     {
         CollectablesBase currCollectable = collectablePool.GetInctance();
         currCollectable.transform.localPosition = new Vector3(LanePos[Random.Range(0, LanePos.Count)].x, currCollectable.transform.position.y, Random.Range(-4, 5));
         currCollectable.gameObject.SetActive(true);
         activeCollectableHolder.Add(currCollectable);
     }
 }
예제 #3
0
        private void Spawn()
        {
            PlatformBase currentPlatform = platformPool.GetInctance();

            currentPlatform.DisablePlatform();
            currentPlatform.transform.position = Vector3.forward * currentPlatformPos.z;
            currentPlatformPos.z += platformData.PlatformLenght;
            currentPlatform.EnablePlatform();
            platformPool.SetInstance(currentPlatform);
        }
예제 #4
0
        private void ShootLazers()
        {
            if (lazerPool.IsPoolEmpty())
            {
                PopulatePool();
            }

            SpawnableBase Lazer = lazerPool.GetInctance();

            Lazer.transform.position = playerView.ShootPos.position;
            Lazer.gameObject.SetActive(true);
        }
예제 #5
0
 private IEnumerator SpawnEnemies()
 {
     while (true)
     {
         if (!enemyPool.IsPoolEmpty())
         {
             EnemyBase enemy = enemyPool.GetInctance();
             enemy.transform.position = spawnPos[Random.Range(0, spawnPos.Count)].position;
             enemy.gameObject.SetActive(true);
             enemy.RestoreEnemy();
             yield return(null);
         }
         yield return(new WaitForSeconds(1f));
     }
 }
예제 #6
0
        private IEnumerator Spawn()
        {
            while (true)
            {
                if (currentPool.IsPoolEmpty() == true)
                {
                    PopulatePool();
                }

                if (CanSpawn)
                {
                    SpawnableBase currAsteroid = currentPool.GetInctance();
                    currAsteroid.SetPool(currentPool);
                    currAsteroid.transform.position = levelView.SpawnPos[Random.Range(0, levelView.SpawnPos.Count)].position;
                    currAsteroid.gameObject.SetActive(true);
                }

                yield return(new WaitForSecondsRealtime(currentLevel.LevelData.spawnRate));
            }
        }