void Awake() { MakeSingleton(); CurrentGameMode = GameMode.BUILD; /* Setup Controller Events */ RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, true, RightControllerEvents_TriggerDown); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, false, RightControllerEvents_TriggerUp); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.GripPress, true, RightControllerEvents_GripDown); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.GripPress, false, RightControllerEvents_GripUp); RightControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TouchpadPress, false, RightControllerEvents_TouchpadUp); LeftControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, true, LeftControllerEvents_TriggerDown); LeftControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress, false, LeftControllerEvents_TriggerUp); LeftControllerEvents.SubscribeToButtonAliasEvent(VRTK.VRTK_ControllerEvents.ButtonAlias.GripPress, false, LeftControllerEvents_GripUp); /* Setup Controller VRTK scripts */ VRTK.VRTK_InteractGrab rightInteractGrab = RightControllerEvents.GetComponent <VRTK.VRTK_InteractGrab>(); rightInteractGrab.grabButton = VRTK.VRTK_ControllerEvents.ButtonAlias.TriggerPress; RightInteractNearTouch = RightControllerEvents.GetComponent <VRTK.VRTK_InteractNearTouch>(); RightInteractTouch = RightControllerEvents.GetComponent <VRTK.VRTK_InteractTouch>(); RightInteractGrab = RightControllerEvents.GetComponent <VRTK.VRTK_InteractGrab>(); RightAnimator = RightControllerEvents.gameObject.GetComponentInChildren <HandAnimator>(); LeftAnimator = LeftControllerEvents.gameObject.GetComponentInChildren <HandAnimator>(); }
protected virtual void OnEnable() { animator = GetComponent <Animator>(); controllerEvents = (controllerEvents != null ? controllerEvents : GetComponentInParent <VRTK_ControllerEvents>()); interactNearTouch = (interactNearTouch != null ? interactNearTouch : GetComponentInParent <VRTK_InteractNearTouch>()); interactTouch = (interactTouch != null ? interactTouch : GetComponentInParent <VRTK_InteractTouch>()); interactGrab = (interactGrab != null ? interactGrab : GetComponentInParent <VRTK_InteractGrab>()); interactUse = (interactUse != null ? interactUse : GetComponentInParent <VRTK_InteractUse>()); controllerReference = VRTK_ControllerReference.GetControllerReference(controllerEvents.gameObject); }
protected virtual void OnEnable() { animator = GetComponent <Animator>(); controllerEvents = (controllerEvents != null ? controllerEvents : GetComponentInParent <VRTK_ControllerEvents>()); interactNearTouch = (interactNearTouch != null ? interactNearTouch : GetComponentInParent <VRTK_InteractNearTouch>()); interactTouch = (interactTouch != null ? interactTouch : GetComponentInParent <VRTK_InteractTouch>()); interactGrab = (interactGrab != null ? interactGrab : GetComponentInParent <VRTK_InteractGrab>()); interactUse = (interactUse != null ? interactUse : GetComponentInParent <VRTK_InteractUse>()); controllerReference = VRTK_ControllerReference.GetControllerReference(controllerEvents.gameObject); transform.localRotation = Quaternion.identity; transform.localPosition = -0.15f * Vector3.forward; }
public virtual void SetInteractNearTouch(VRTK_InteractNearTouch givenInteractNearTouch) { interactNearTouch = givenInteractNearTouch; }