Exemple #1
0
        void OnExit(Rigidbody rb, bool isSpecial)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction != null)
            {
                if (interaction.totalTouchCount == 1)
                {
                    Touch(interaction, false);
                }

                if (interaction.totalTouchCount > 0)
                {
                    interaction.totalTouchCount--;
                }
                if (interaction.specialTouchCount > 0 && isSpecial)
                {
                    interaction.specialTouchCount--;
                }
            }
        }
Exemple #2
0
        void OnEnter(Rigidbody rb, bool isSpecial)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction != null)
            {
                if (interaction.totalTouchCount == 0)
                {
                    Touch(interaction, true);
                }

                interaction.totalTouchCount++;
                if (isSpecial)
                {
                    interaction.specialTouchCount++;
                }
            }
        }
Exemple #3
0
        void OnExit_Hover(Rigidbody rb)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction != null)
            {
                Hover(interaction, false);

                // Update() will .Remove unhovered interactions after calling EventWaterfall()
            }
        }
Exemple #4
0
        void OnEnter_Hover(Rigidbody rb)
        {
            InteractableRef interactableRef = rb.GetComponent <InteractableRef>();

            if (!interactableRef)
            {
                return;
            }

            InteractionModel interaction = model.interactions.Find(x => x.interactable == interactableRef.interactable);

            if (interaction == null)
            {
                interaction = new InteractionModel();
                interaction.interactable = interactableRef.interactable;
                interaction.interactor   = this;

                model.interactions.Add(interaction);

                Hover(interaction, true);
            }
        }