private IEnumerator ReturnObject() { yield return(new WaitForSeconds(16)); AsteroidPool.ReturnObject(this); destroyAsteroid = null; }
private void SubscribeToEvents(AsteroidPool asteroidPool) { foreach (Asteroid asteroid in asteroidPool.AllObjects) { asteroid.StateChanged += OnStateChanged; } }
private void Awake() { if (Instance == null) { Instance = this; } }
void Start() { particle = GetComponent <ParticleSystem>(); pool = FindObjectOfType <AsteroidPool>(); renderer = GetComponent <MeshRenderer>(); gameManager = FindObjectOfType <GameManager>(); particle.Stop(); }
private IEnumerator TimerAsteroid() { yield return(new WaitForSeconds(delaySpawn)); var asteroid = AsteroidPool.GetObject(GetPointAsteroid(), Vector3.down); StartCoroutine(TimerAsteroid()); }
public void Death() { Destroy(gameObject); GameMaster gm = GameObject.Find("GameMaster").GetComponent <GameMaster> (); AsteroidPool aP = GameObject.Find("GameMaster").GetComponent <AsteroidPool> (); gm.GameOver(); aP.over = true; }
public static void RestartLevel() { instance.currentLevelType = null; instance.mainUi.HideEndPanel(); instance.mainUi.ShowGamePanel(); AsteroidPool.ClearAsteroid(); instance.player.StartHealth(); instance.player.transform.position = Vector3.zero; StartGame(instance.currentIndextLevel); }
public void Initialize() { if (!InitializeSingleton(this)) { return; } TRexPool = GetComponentInChildren <TRexPool>(); AsteroidPool = GetComponentInChildren <AsteroidPool>(); PickupPool = GetComponentInChildren <PickupPool>(); QuicksandPool = GetComponentInChildren <QuicksandPool>(); }
private void Start() { pool = GetComponent <AsteroidPool>(); StartGame(); pool.SetSpawnActive(true); timer = timeToQuestions; currentLife = life; Spaceship.Instance.UpdateLifeBar(life, currentLife); UIController.UpdateLife(currentLife); UIController.UpdateScore(score); }
// Use this for initialization void Start() { //InvokeRepeating("SpawnHazards", 2, 3); isGameOver = false; ui = GameObject.FindGameObjectWithTag("UIController").GetComponent <UIController>(); AsteroidP = GetComponent <AsteroidPool>(); EffectP = GetComponent <EffectPool>(); EnemyP = GetComponent <EnemyPool>(); ItemP = GetComponent <ItemPool>(); BossP = GameObject.FindGameObjectWithTag("BossPool").GetComponent <BossPool>(); Player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); CurrentLifeCount = StartLifeCount; ui.SetLife(CurrentLifeCount); ItemSpawnCount = 0; IsBossAlive = false; CurrentBossSpawnCount = BossSpawnCount; harzardRoutine = StartCoroutine(Hazards(StartWaitingTime, StageTimeGap)); }
public void Init() { var projectilePools = GetComponentsInChildren <ProjectilePool>(true); foreach (var projectilePool in projectilePools) { if (!_projectilePools.Contains(projectilePool)) { _projectilePools.Add(projectilePool); } } foreach (var projectilePool in _projectilePools) { projectilePool.Init(); } if (_asteroidPool == null) { _asteroidPool = GetComponentInChildren <AsteroidPool>(); } _asteroidPool.Init(); }
public void DestroyAsteroid() { AsteroidPool.ReturnObject(thisAsteroid); }
void Awake() { instance = this; CreatePool(); }
private void Awake() { asteroidPool = this; }