private void Fire() { ShellBase newShell = shellPool.GetInctance(); newShell.transform.position = shellHolder.position; newShell.transform.forward = shellHolder.transform.forward; newShell.gameObject.SetActive(true); newShell.Fire(); }
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); } }
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); }
private void ShootLazers() { if (lazerPool.IsPoolEmpty()) { PopulatePool(); } SpawnableBase Lazer = lazerPool.GetInctance(); Lazer.transform.position = playerView.ShootPos.position; Lazer.gameObject.SetActive(true); }
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)); } }
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)); } }