Example #1
0
    protected override void _OnTarget(Gunner target, Vector3 hitPos)
    {
        RaycastHit2D[] hits = Physics2D.CircleCastAll(m_trsf.position, m_splashRadius, Vector2.zero);

        foreach (RaycastHit2D hit in hits)
        {
            if (hit.collider.gameObject == gameObject)
            {
                continue;
            }

            if (hit.collider.tag == "SPACESHIP_NORMAL")
            {
                SpaceShipCtrl ctrl = hit.collider.gameObject.GetComponent <SpaceShipCtrl>();

                ctrl.Hit(m_splashDamage);

                PlayEffect(m_effect_explosion, ctrl.Position);
            }
            else if (hit.collider.tag == "SPACESHIP_DUMMY")
            {
                SpaceShipCtrl ctrl = hit.collider.gameObject.GetComponent <SpaceShipCtrl>();

                ctrl.Hit(m_splashDamage);

                PlayEffect(m_effect_explosion, ctrl.Position);
            }
        }

        base._OnTarget(target, hitPos);
    }