Ejemplo n.º 1
0
 /// <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>();
     }
 }
Ejemplo n.º 3
0
    void Start()
    {
        isLeftFlying  = false;
        isRightFlying = false;
        GameObject pa = GameObject.FindGameObjectWithTag("PlayArea");

        bp = pa.GetComponent <VRTK_BodyPhysics>();
    }
Ejemplo n.º 4
0
    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;
            }
        }
Ejemplo n.º 6
0
    void Awake()
    {
        if (!bodyPhysics)
        {
            bodyPhysics = GetComponent <VRTK_BodyPhysics>();
        }
        if (!bodyPhysics)
        {
            enabled = false;
        }

        if (!climbMovement)
        {
            climbMovement = GetComponent <VRTK_PlayerClimb>();
        }
    }
Ejemplo n.º 7
0
    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();
    }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     bp     = GameObject.FindGameObjectWithTag("PlayArea").GetComponent <VRTK_BodyPhysics>();
     sounds = soundsManager.GetComponents <AudioSource>();
     smokeTrail.Stop();
 }
Ejemplo n.º 9
0
 /// <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));
 }
Ejemplo n.º 10
0
 /// <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));
 }