Exemplo n.º 1
0
 /// <summary>
 /// Configures the action used to control grabbing.
 /// </summary>
 public virtual void ConfigureGrabAction()
 {
     if (grabAction != null && facade != null && facade.grabAction != null)
     {
         grabAction.AddSource(facade?.grabAction);
     }
 }
        /// <summary>
        /// Sets up the Interactor prefab with the specified settings.
        /// </summary>
        public virtual void Setup()
        {
            if (InvalidParameters())
            {
                return;
            }

            grabAction.AddSource(facade.grabAction);
            velocityTracker.velocityTrackers.Clear();
            velocityTracker.velocityTrackers.Add(facade.velocityTracker);
        }
        /// <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;
            }
        }
Exemplo 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);
 }