/// <summary>
 /// Configures the action used to control grabbing.
 /// </summary>
 public virtual void ConfigureGrabAction()
 {
     if (grabAction != null && facade != null && facade.GrabAction != null)
     {
         grabAction.ClearSources();
         grabAction.AddSource(facade.GrabAction);
     }
 }
        /// <summary>
        /// Clears all of the settings from the Interactor prefab.
        /// </summary>
        public virtual void Clear()
        {
            if (InvalidParameters())
            {
                return;
            }

            grabAction.ClearSources();
            velocityTracker.velocityTrackers.Clear();
        }
        /// <summary>
        /// Sets up the Pointer prefab with the specified settings.
        /// </summary>
        public virtual void Setup()
        {
            if (InvalidParameters())
            {
                return;
            }

            caster.targetValidity = facade.targetValidity;

            if (facade.followTarget != null)
            {
                objectFollow.targetComponents.Clear();
                objectFollow.targetComponents.Add(facade.followTarget.TryGetComponent <Component>());
            }

            if (facade.selectionAction != null)
            {
                selectOnActivatedAction.ClearSources();
                selectOnActivatedAction.AddSource(facade.selectionAction);
                selectOnDeactivatedAction.ClearSources();
                selectOnDeactivatedAction.AddSource(facade.selectionAction);
            }

            if (facade.activationAction != null)
            {
                activationAction.ClearSources();
                activationAction.AddSource(facade.activationAction);
            }

            switch (facade.selectionType)
            {
            case PointerFacade.SelectionType.SelectOnActivate:
                selectOnActivatedAction.gameObject.SetActive(true);
                selectOnDeactivatedAction.gameObject.SetActive(false);
                break;

            case PointerFacade.SelectionType.SelectOnDeactivate:
                selectOnActivatedAction.gameObject.SetActive(false);
                selectOnDeactivatedAction.gameObject.SetActive(true);
                break;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the adds the <see cref="source"/> to the Sources collection of the <see cref="target"/> <see cref="BooleanAction"/>.
 /// </summary>
 /// <param name="source">The <see cref="BooleanAction"/> to add as a source.</param>
 /// <param name="target">The <see cref="BooleanAction"/> to have the Sources collection updated.</param>
 protected virtual void SetInputSource(BooleanAction source, BooleanAction target)
 {
     target.ClearSources();
     target.AddSource(source);
 }