Example #1
0
        public IEnumerator Kill()
        {
            ManagerHandler.Get <VibrationManager>().Vibrate();
            Model.gameObject.SetActive(false);
            PlayFeedback.gameObject.SetActive(false);
            DeathFeedback.transform.position = Model.transform.position;
            DeathFeedback.PlayAll();
            yield return(null);

            Deactivate();
        }
Example #2
0
 public void Kill()
 {
     _deathFeedback?.PlayAll();
     _currentHealth = 0;
     SetInvulnerable(false);
     gameObject.SetActive(false);
     if (_character.CharacterType == CharacterType.Player)
     {
         GenericEvent.Trigger(GenericEventType.PlayerDied, gameObject);
     }
     else
     {
         GenericEvent.Trigger(GenericEventType.EnemyDestroyed, gameObject);
     }
 }
        public override void OnEnter()
        {
            base.OnEnter();
            Vector3 target = _brain.Target != null ? _brain.Target.position : Vector3.down;

            // Aim at target
            Vector3 direction = target - transform.position;

            var bullet = _spawnerManager.LendBullet(BulletType);

            // Assign bullet speed
            bullet.Speed = BulletSpeed;
            // Shoot a bullet at target
            bullet.Fire(transform.position, direction.normalized, gameObject);
            _timer = TransitionExitTime;
            _shootingFeedback.PlayAll();
        }
 /// <summary>
 /// Called when the player collides with a collectable
 /// </summary>
 public void OnCollect()
 {
     _model.gameObject.SetActive(false);
     _collectFeedback.PlayAll();
 }
Example #5
0
 protected virtual void Shoot()
 {
     // Get an inactive bullet from the pool and shoot it
     _spawnerManager.LendBullet(BulletType).Fire(transform.position, Vector3.up, gameObject);
     _shootingFeedback.PlayAll();
 }