Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        var obj = collision.gameObject;

        while (obj)
        {
            if (Ship == obj)
            {
                return;
            }
            var parentTransform = obj.transform.parent;
            if (!parentTransform)
            {
                break;
            }
            obj = parentTransform.gameObject;
        }
        obj = collision.gameObject;
        Ship          ship  = obj.GetComponent <Ship>();
        ShildFunction shild = obj.GetComponent <ShildFunction>();

        if (ship)
        {
            OnBoom();
            ship.Boom(Damage, WeaponType);
            BulletPool.get().Recycle(gameObject);
        }
        if (shild)
        {
            OnBoom();
            shild.Boom(Damage, WeaponType);
            BulletPool.get().Recycle(gameObject);
        }
    }
Ejemplo n.º 2
0
    public Shild()
    {
        EmiterResource = "Perfabs/Feature/EmiterShild";
        EffectResource = "Perfabs/Feature/Shild";

        m_ShildObj = GameObject.Instantiate(Resources.Load <GameObject>(EffectResource));

        ShildFunction shildFunction = m_ShildObj.GetComponent <ShildFunction>();

        shildFunction.m_Shild = this;
    }