/// <summary> /// Observable StartLeaning event /// </summary> /// <param name="events"></param> /// <returns></returns> public static IObservable <BodyPhysicsEventArgs> StartLeaningAsObservable(this VRTK_BodyPhysics events) { return(Observable.FromEvent <BodyPhysicsEventHandler, BodyPhysicsEventArgs>( h => (s, e) => h(e), h => events.StartLeaning += h, h => events.StartLeaning -= h)); }
private void SetBodyPhysics() { if (bp == null) { bp = GetComponent <VRTK_BodyPhysics>(); } }
void Start() { isLeftFlying = false; isRightFlying = false; GameObject pa = GameObject.FindGameObjectWithTag("PlayArea"); bp = pa.GetComponent <VRTK_BodyPhysics>(); }
protected virtual void Awake() { BodyPhysics = (BodyPhysics != null ? BodyPhysics : GetComponentInChildren <VRTK_BodyPhysics>()); HeadsetCollision = (HeadsetCollision != null ? HeadsetCollision : GetComponentInChildren <VRTK_HeadsetCollision>()); PositionRewind = (PositionRewind != null ? PositionRewind : GetComponentInChildren <VRTK_PositionRewind>()); VRTK_SDKManager.instance.AddBehaviourToToggleOnLoadedSetupChange(this); }
void MakeItSo() { var go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } if (!enablePointer.IsNone) { pointer = go.GetComponent <VRTK_Pointer>(); pointer.enabled = enablePointer.Value; } // set pointer renderer to be beizer if (enableBezierRenderer.Value) { bezier = go.GetComponent <VRTK_BezierPointerRenderer>(); pointer.pointerRenderer = bezier; } // set pointer renderer to be straight if (enableStraightRenderer.Value) { straight = go.GetComponent <VRTK_StraightPointerRenderer>(); pointer.pointerRenderer = straight; } if (!enableBezierRenderer.IsNone) { bezier = go.GetComponent <VRTK_BezierPointerRenderer>(); bezier.enabled = enableBezierRenderer.Value; } if (!enableHeightAdjustTele.IsNone) { heightTeleport = go.GetComponent <VRTK_HeightAdjustTeleport>(); heightTeleport.enabled = enableHeightAdjustTele.Value; } if (!enableStraightRenderer.IsNone) { straight = go.GetComponent <VRTK_StraightPointerRenderer>(); straight.enabled = enableStraightRenderer.Value; } if (!enableBodyTeleport.IsNone) { bodyPhysics = bodyPhysicsGO.Value.GetComponent <VRTK_BodyPhysics>(); bodyPhysics.enableTeleport = enableBodyTeleport.Value; } }
void Awake() { if (!bodyPhysics) { bodyPhysics = GetComponent <VRTK_BodyPhysics>(); } if (!bodyPhysics) { enabled = false; } if (!climbMovement) { climbMovement = GetComponent <VRTK_PlayerClimb>(); } }
protected override void Awake() { bodyPhysics = FindObjectOfType <VRTK_BodyPhysics>(); playAreas = FindObjectsOfType <VrPlayArea>(); if (playAreas.Length == 0) { Debug.LogError("No play areas!", gameObject); } if (checkForCollisions) { hitColliders = new Collider[5]; } base.Awake(); }
// Use this for initialization void Start() { bp = GameObject.FindGameObjectWithTag("PlayArea").GetComponent <VRTK_BodyPhysics>(); sounds = soundsManager.GetComponents <AudioSource>(); smokeTrail.Stop(); }
/// <summary> /// Observable DestinationMarkerSet event /// </summary> /// <param name="events"></param> /// <returns></returns> public static IObservable <DestinationMarkerEventArgs> DestinationMarkerSetAsObservable(this VRTK_BodyPhysics events) { return(Observable.FromEvent <DestinationMarkerEventHandler, DestinationMarkerEventArgs>( h => (s, e) => h(e), h => events.DestinationMarkerSet += h, h => events.DestinationMarkerSet -= h)); }
/// <summary> /// Observable StopTouchingGround event /// </summary> /// <param name="events"></param> /// <returns></returns> public static IObservable <BodyPhysicsEventArgs> StopTouchingGroundAsObservable(this VRTK_BodyPhysics events) { return(Observable.FromEvent <BodyPhysicsEventHandler, BodyPhysicsEventArgs>( h => (s, e) => h(e), h => events.StopTouchingGround += h, h => events.StopTouchingGround -= h)); }