Exemplo n.º 1
0
    private void RegisterBulletListener(GameObject SprayColliderBullet)
    {
        ColliderEventHelper eventHelper = SprayColliderBullet.GetComponent <ColliderEventHelper>();

        eventHelper.from = start;
        if (isTrigger)
        {
            eventHelper.notifyTriggerEnter += OnTrigger;
        }
        else
        {
            eventHelper.notifyCollisionEnter += OnCollision;
        }
    }
Exemplo n.º 2
0
    void AddCollider(EffectCollider effectCollider, Vector3 position)
    {
        //Debug.Log("AddCollider");
        GameObject          colliderHolder      = GameObject.Instantiate(prafabHolder.ColliderHolder, position, Quaternion.identity);
        SphereCollider      collider            = colliderHolder.AddComponent <SphereCollider>();
        ColliderEventHelper colliderEventHelper = colliderHolder.GetComponent <ColliderEventHelper>();

        colliderEventHelper.timeToLive = effectCollider.duration;

        collider.radius    = effectCollider.radius;
        collider.isTrigger = effectCollider.isTrigger;

        if (effectCollider.isTrigger)
        {
            colliderEventHelper.notifyTriggerEnter += OnTriggerCollider;
        }
        else
        {
            colliderEventHelper.notifyCollisionEnter += OnEnterCollider;
        }
    }