Ejemplo n.º 1
0
    void OnTriggerEnter(Collider other)
    {
        OnDestructing();
        Damaging damaging = GetComponent <Damaging> ();

        if (damaging)
        {
            damaging.Damage(other.gameObject);
        }
    }
Ejemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        GameObject player = PlayerManager.Instance.GetPlayer();

        if (other.tag == player.tag)
        {
            other.attachedRigidbody.AddForceAtPosition(m_velocity * m_forceImpactMultiplier, other.ClosestPoint(this.transform.position), ForceMode.Impulse);
        }
        Damaging damaging = GetComponent <Damaging> ();

        if (damaging)
        {
            damaging.Damage(other.gameObject);
        }
        PoolManager.Instance.returnPoolElement(PoolManager.PoolType.PROJECTILE, this.gameObject);
        GameObject hit = PoolManager.Instance.GetPoolElement(PoolManager.PoolType.HIT);

        if (hit)
        {
            hit.transform.position = this.transform.position;
            hit.SetActive(true);
        }
    }