Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
    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);
            }
        }
    }
Beispiel #3
0
    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);
            }
        }
    }
Beispiel #4
0
 protected override void DestroyProjectile()
 {
     elapsedTime = 0f;
     poolObject.Deactivate(true);
 }
Beispiel #5
0
 public void DestroyCharacter()
 {
     _PoolObject.Deactivate();
 }