示例#1
0
        private void OnTriggerExit(Collider other)
        {
            if (_interactions.Contains(other.GetComponent <Interaction>()))
            {
                _interactions.Remove(other.GetComponent <Interaction>());
                other.GetComponent <Interaction>().player = null;
            }

            if (_activations.Contains(other.GetComponent <OnActivation>()))
            {
                _activations.Remove(other.GetComponent <OnActivation>());
            }

            if (StoreInteraction)
            {
                StoreInteraction        = false;
                _storeInteractionObject = null;
            }

            if (_plan)
            {
                _plan = false;
                _activatePlan.player = null;
                _activatePlan        = null;
            }
        }
示例#2
0
        private void OnTriggerStay(Collider other)
        {
            if (other.GetComponent <Interaction>() && other.gameObject.activeSelf)
            {
                if (!_interactions.Contains(other.GetComponent <Interaction>()))
                {
                    _interactions.Add(other.GetComponent <Interaction>());
                    other.GetComponent <Interaction>().player = this;
                }
            }
            if (other.GetComponent <OnActivation>())
            {
                if (!_activations.Contains(other.GetComponent <OnActivation>()) && other.gameObject.activeSelf)
                {
                    _activations.Add(other.GetComponent <OnActivation>());
                    other.GetComponent <OnActivation>().player = this;
                }
            }

            if (other.GetComponent <StoreInteraction>())
            {
                if (other.gameObject.activeSelf)
                {
                    StoreInteraction        = true;
                    _storeInteractionObject = other.GetComponent <StoreInteraction>();
                }
            }

            if (other.GetComponent <ActivatePlan>())
            {
                if (other.gameObject.activeSelf)
                {
                    _plan                = true;
                    _activatePlan        = other.GetComponent <ActivatePlan>();
                    _activatePlan.player = this;
                }
            }
        }