Beispiel #1
0
        /// <summary>
        /// Drops the current Weapon into the scene
        /// </summary>
        public IEnumerator DropCurrentWeapon()
        {
            _switchingWeapons = true;
            if (LogDebug)
            {
                Debug.Log("Dropping current weapon in slot " + _currentWeapon);
            }
            if (GetCurrentWeaponGo() == null || GetCurrentWeaponComponent().PickupReference == null)
            {
                Debug.Log("Either there is no weapon equippped or the weapon doesn't have a Pickup Reference defined.");
                _switchingWeapons = false;
                yield break;
            }
            StaticUtil.SpawnLoot(WeaponListRuntime[_currentWeapon].GetComponent <Weapon>().PickupReference, transform.position);

            GameObject droppingThis = WeaponListRuntime[_currentWeapon];

            WeaponListRuntime.RemoveAt(_currentWeapon);
            if (WeaponListRuntime.Count == _currentWeapon)
            {
                _currentWeapon -= 1;
            }

            yield return(StartCoroutine(ChangeWeaponToSlot(_currentWeapon)));

            _switchingWeapons = true;

            StaticUtil.DeSpawn(droppingThis);
            while (_myControls.GetInputDropWeapon)
            {
                yield return(null);
            }
            _switchingWeapons = false;
        }
 public void DeSpawn()
 {
     // using DeSpawn() to apply aoe dmg?... not sure if that is okay...
     if (Stats.CauseAoeDamage && Stats.Bouncer && !_despawning)
     {
         _despawning = true;
         DoDamageAoe();
     }
     StaticUtil.DeSpawn(gameObject);
 }
        public IEnumerator StartLifetimer(float time)
        {
            yield return(new WaitForSeconds(time));

            if (CallDespawn)
            {
                gameObject.SendMessage("DeSpawn", SendMessageOptions.DontRequireReceiver);
            }
            else
            {
                StaticUtil.DeSpawn(gameObject);
            }
            Destroy(this); // remove this script - important!
        }
Beispiel #4
0
        IEnumerator SpawnerLoop()
        {
            while (!Completed)
            {
                _curWave++;
                SpawnWave();

                if (SpawnerType == SpawnerStyle.FixedCount && _curWave >= FixedWaveCount)
                {
                    StaticUtil.DeSpawn(gameObject);
                }
                yield return(_waveGap);
            }
        }
Beispiel #5
0
 public void DeSpawn()
 {
     // Pooling TBD
     StaticUtil.DeSpawn(gameObject);
 }
Beispiel #6
0
 void Disappear()
 {
     StaticUtil.DeSpawn(gameObject);
 }
Beispiel #7
0
        IEnumerator Life()
        {
            yield return(new WaitForSeconds(Duration));

            StaticUtil.DeSpawn(gameObject);
        }
Beispiel #8
0
 void Done()
 {
     StaticUtil.DeSpawn(gameObject);
 }