예제 #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;
        }
예제 #2
0
 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);
 }
예제 #3
0
        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!
        }
예제 #4
0
        IEnumerator SpawnerLoop()
        {
            while (!Completed)
            {
                _curWave++;
                SpawnWave();

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

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