Esempio n. 1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Enemy"))
     {
         _onEnemyCollision.Invoke();
         if (_screenShake)
         {
             _screenShake.Shake(amount, duration);
         }
         _hp.AddHp(-1);
         Instantiate(_particleSystem).transform.position = _transform.position;
     }
 }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Player"))
        {
            _health = collision.GetComponent <PlayerHealth>();
            if (_health)
            {
                _health.AddHp(m_recoverAmount);
            }

            if (_system && _transform)
            {
                // TODO:: Review how to instantiate this later
                ParticleSystem x = Instantiate(_system);
                x.transform.position = _transform.position;
                x.transform.parent   = GlobalInfo.ParticleContainer.transform;
            }
            gameObject.SetActive(false);
        }
    }