Пример #1
0
    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.layer == Globals.LAYER_ENTITY)
        {
            entity = null;
            if (onTriggerEntity != null)
            {
                onTriggerEntity(other.GetComponent <EntityBase>());
            }
        }
        else if (other.gameObject.layer == Globals.LAYER_MATERIAL)
        {
            materials.Remove(other.gameObject);
        }
        else if (other.gameObject.layer == Globals.LAYER_TRANSPORT)
        {
            transport = null;
            if (onTriggerTransport != null)
            {
                onTriggerTransport(other.GetComponent <TransportByCollider>());
            }
        }

        if (onTriggerExit != null)
        {
            onTriggerExit(other);
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        // for test
        isWorking = true;
        outSlot   = new Slot();
        outHitBox = GetComponentInChildren <HitBox>();

        outHitBox.onTriggerTransport += delegate(TransportByCollider transport) {
            outTransport = outHitBox.transport;
        };

        animator = GetComponentInChildren <Animator>();
    }