Esempio n. 1
0
 private void Update()
 {
     if (IsLifeSpanOver())
     {
         gameObject.SetActive(false);
         _gun.AddToPool(this);
     }
 }
Esempio n. 2
0
    private void OnCollisionEnter(Collision collision)
    {
        gameObject.SetActive(false);
        _gun.AddToPool(this);

        var enemy = collision.gameObject.GetComponent <Enemy>();

        if (enemy)
        {
            enemy.TakeDamage(collision.contacts[0].point);
        }
    }
Esempio n. 3
0
    public void OnCollisionEnter(Collision collision)
    {
        gameObject.SetActive(false);
        _gun?.AddToPool(this);

        var enemy = collision.collider.GetComponent <Enemy>();

        if (enemy != null)
        {
            int playerNumber = _gun.GetComponent <Player>().PlayerNumber;
            enemy.TakeDamage(collision.contacts[0].point, playerNumber);
        }
    }