Exemple #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Enemy"))
     {
         GameplayEvents.EnemyKilled(other.transform.position);
         Destroy(other.gameObject);
     }
 }
        private void Damaged(int amount)
        {
            if (GameEvents.gameOver)
            {
                return;
            }
            GameplayEvents.EnemyKilled(_player.transform.position);
            if (PrefsManager.Player.Lifes - amount < 1)
            {
                GameEvents.GameOver();
                _player.gameObject.SetActive(false);
            }

            _immuneTimer = 0f;
            PrefsManager.Player.RemoveLifes(amount);
            _player.visual.Damaged();
        }
Exemple #3
0
        public override void OnAttack()
        {
            _muzzleFlesh.transform.localScale = Vector3.one * 0.5f;

            _timer = _time;
            _muzzleFlesh.NextFrame();

            RaycastHit2D hit =
                Physics2D.Raycast(gameObject.transform.position + transform.right * 2, transform.right, 100);

            if (hit.transform != null)
            {
                if (hit.collider.CompareTag("Enemy"))
                {
                    GameplayEvents.EnemyKilled(hit.transform.position);
                    Destroy(hit.transform.gameObject);
                }
            }
        }