public void LoseLife() { if (_remainingLives > 0) { --_remainingLives; // do animation based on the lost life int lifeAnim = _level.MaxAmountOfLives - _remainingLives; _anim.Play("LoseLife" + lifeAnim); if (_loadedBullet != null) { _loadedBullet.Deactivate(); _loadedBullet = null; } StartCoroutine("DisableLife", lifeAnim); } }
public void DeactivateAllPoolObjects(GameObject poolObj) { int poolKey = poolObj.GetInstanceID(); if (_poolDictionary.ContainsKey(poolKey)) { int poolSize = _poolDictionary [poolKey].Count; for (int i = 0; i < poolSize; i++) { PoolObject objectGet = _poolDictionary [poolKey].Dequeue(); objectGet.Deactivate(_currentTransform); _poolDictionary [poolKey].Enqueue(objectGet); } } }
public void CreatePool(GameObject prefab, int poolSize) { int poolKey = prefab.GetInstanceID(); if (!_poolDictionary.ContainsKey(poolKey)) { _poolDictionary.Add(poolKey, new Queue <PoolObject> ()); for (int i = 0; i < poolSize; i++) { PoolObject newObject = Instantiate(prefab).GetComponent <PoolObject>(); newObject.Deactivate(_currentTransform); _poolDictionary [poolKey].Enqueue(newObject); } } }
protected override void DestroyProjectile() { elapsedTime = 0f; poolObject.Deactivate(true); }
public void DestroyCharacter() { _PoolObject.Deactivate(); }