private void CheckButtonInteraction(ref HitResult3D result)
        {
            ButtonComponentBase currentButton = null;

            if (result.Succeeded)
            {
                Entity entityHiting = (result.PhysicBody.UserData as PhysicBody3D).Owner;
                currentButton = entityHiting?.Parent?.FindComponent <ButtonComponentBase>(false);
                if (currentButton != null)
                {
                    if (!currentButton.Hover)
                    {
                        currentButton.Hover = true;
                    }
                    if (this.TriggerValue > 0 && this.lastTriggerValue == 0)
                    {
                        currentButton?.Touch();
                    }

                    if (currentButton != this.lastButton && this.lastButton != null)
                    {
                        this.lastButton.Hover = false;
                    }
                }
                else
                {
                    if (this.lastButton != null)
                    {
                        this.lastButton.Hover = false;
                    }
                }
            }
            else
            {
                if (this.lastButton != null)
                {
                    this.lastButton.Hover = false;
                }
            }

            this.lastButton = currentButton;
        }
예제 #2
0
 private void Reset()
 {
     Button = GetComponent <ButtonComponentBase>();
 }
 private void Reset()
 {
     Button = GetComponentInChildren <ButtonComponentBase>();
 }
예제 #4
0
 private void Reset()
 {
     InvertReference = false;
     Button          = GetComponentInChildrenAdvanced <ButtonComponentBase>();
 }