protected virtual void Awake()
        {
            if (OnEnter == null)
            {
                OnEnter = new EventDistanceInteraction();
            }

            if (OnStay == null)
            {
                OnStay = new EventDistanceInteraction();
            }

            if (OnExit == null)
            {
                OnExit = new EventDistanceInteraction();
            }

            if (OnRelease == null)
            {
                OnRelease = new EventDistanceInteraction();
            }

            if (OnStatusRelease == null)
            {
                OnStatusRelease = new EventDistanceInteractionRelease();
            }

            if (OnNotRelease == null)
            {
                OnNotRelease = new UnityEvent();
            }

            //加入时,检索一次
            if (distanceData == null)
            {
                distanceData = new DistanceData();
            }

            if (ActiveShadow)
            {
                AddShadow();
            }
            else
            {
                RemoveShadow();
            }

            if (ActiveParent)
            {
                AddParent();
            }
            else
            {
                RemoveParent();
            }
        }
Beispiel #2
0
        private void Awake()
        {
            if (OnEnter == null)
            {
                OnEnter = new EventDistanceInteraction();
            }

            if (OnStay == null)
            {
                OnStay = new EventDistanceInteraction();
            }

            if (OnExit == null)
            {
                OnExit = new EventDistanceInteraction();
            }

            if (OnRelease == null)
            {
                OnRelease = new EventDistanceInteraction();
            }

            if (OnNotRelease == null)
            {
                OnNotRelease = new UnityEvent();
            }

            //加入时,检索一次
            if (distanceData == null)
            {
                distanceData = new DistanceData();
            }

            distanceData.Interaction = this;

            if (FeaturesObjectController == null)
            {
                FeaturesObjectController = gameObject.GetComponent <Features.FeaturesObjectController>();

                if (FeaturesObjectController == null)
                {
                    FeaturesObjectController = gameObject.GetComponentInParent <Features.FeaturesObjectController>();
                }
            }
        }
        protected virtual void Awake()
        {
            if (OnEnter == null)
            {
                OnEnter = new EventDistanceInteraction();
            }

            if (OnStay == null)
            {
                OnStay = new EventDistanceInteraction();
            }

            if (OnExit == null)
            {
                OnExit = new EventDistanceInteraction();
            }

            if (OnRelease == null)
            {
                OnRelease = new EventDistanceInteraction();
            }

            if (OnStatusRelease == null)
            {
                OnStatusRelease = new EventDistanceInteractionRelease();
            }

            if (OnNotRelease == null)
            {
                OnNotRelease = new UnityEvent();
            }

            //加入时,检索一次
            if (distanceData == null)
            {
                distanceData = new DistanceData();
            }

            distanceData.Interaction = this;

            if (FeaturesObjectController == null)
            {
                FeaturesObjectController = gameObject.GetComponent <Features.FeaturesObjectController>();

                if (FeaturesObjectController == null)
                {
                    FeaturesObjectController = gameObject.GetComponentInParent <Features.FeaturesObjectController>();
                }
            }

            if (ActiveShadow)
            {
                AddShadow();
            }
            else
            {
                RemoveShadow();
            }

            if (ActiveParent)
            {
                AddParent();
            }
            else
            {
                RemoveParent();
            }
        }