protected void OnDisable() { if (doneSpawning) { rigidbody.velocity = Vector3.zero; if (catParticlePool == null) { catParticlePool = TapGOPoolSingleton <CatParticle> .PoolInstance(); } TapGameObject particle = catParticlePool.GetObject(); if (particle) { particle.gameObject.SetActive(true); particle.GetComponent <CatParticle>().PlayAtLocation(transform.position); } else { Debug.LogError("Could not play particle system"); } gameManager.IncScore(1); popSound.Play(); } doneSpawning = false; base.OnDisable(); }
// Use this for initialization void Awake() { tapAreaSound = AudioManager.Instance().GetAudioSource("TapAreaSound"); activeTapAreaPool = TapGOPoolSingleton <TapArea> .ActivePoolInstance(); tapAreaPool = TapGOPoolSingleton <TapArea> .PoolInstance(); if (!activeTapAreaPool || !tapAreaPool) { Debug.LogError("Cannot find activeTapAreaPool!"); } }
// Use this for initialization void Awake() { target = GameManager.Instance().playerBase.transform; spawnPoints = new List <Transform>(); activeEnemyPool = TapGOPoolSingleton <Enemy> .ActivePoolInstance(); enemyPool = TapGOPoolSingleton <Enemy> .PoolInstance(); if (!activeEnemyPool || !enemyPool || !target) { Debug.LogError("Cannot find activeEnemyPool!"); } // Build the spawner list from child objects with the "spawner" tag foreach (Transform t in transform.GetComponentsInChildren <Transform>()) { if (t.tag == "Spawner") { spawnPoints.Add(t); } } currtime = 0f; nexttime = timeBetweenSpawns; }