Пример #1
0
 private void Update()
 {
     if (IsLifeSpanOver())
     {
         gameObject.SetActive(false);
         _gun.AddToPool(this);
     }
 }
Пример #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);
        }
    }
Пример #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);
        }
    }