private void onWipeUpdate(object sender, SystemWipeArgs eventArgs) {
		if ( !m_enabled ) { return; }

		string debugLine = "Debug";
		if ( eventArgs.WipeInfo.Status == Leap.Util.Status.SwipeAbort ) {
			debugLine += " | Abort";
			// If the user aborts, tween back to original location
			if ( m_lastLockedState == TransitionState.ON ) {
				TweenToOnPosition();
			}
			else {
				TweenToOffPosition();
			}
		}

		if ( m_currentTransitionState == TransitionState.MANUAL ) {
			debugLine += " | Manual Control";
			float percentage = Mathf.Clamp01(eventArgs.WipeInfo.Progress);

			debugLine += ": " + percentage;
			transform.localPosition = Vector3.Lerp(m_from, m_to, percentage);

			// If we're sure of the gesture, just go make the transition
			if ( percentage >= m_percentageToLockTransition ) {
				debugLine += " | Transition Cofirmed";
				if ( m_lastLockedState == TransitionState.OFF ) {
					TweenToOnPosition();
				}
				else {
					TweenToOffPosition();
				}
			}
		}
		else if ( m_currentTransitionState == TransitionState.TWEENING ) {
			debugLine += " | Currently Tweening";
			//Debug.Log(debugLine);
			return;
		}
		else { // We're either on or off
			debugLine += " | Locked";
			if ( eventArgs.WipeInfo.Progress >= m_minProgressToStartTransition ) {
				debugLine += " | Go To Manual";
				m_currentTransitionState = TransitionState.MANUAL; 
			}
		}

		//Debug.Log(debugLine);
	}
    private void onWipeUpdate(object sender, SystemWipeArgs eventArgs)
    {
        if (!m_enabled)
        {
            return;
        }

        string debugLine = "Debug";

        if (eventArgs.WipeInfo.Status == Leap.Util.Status.SwipeAbort)
        {
            debugLine += " | Abort";
            // If the user aborts, tween back to original location
            if (m_lastLockedState == TransitionState.ON)
            {
                TweenToOnPosition();
            }
            else
            {
                TweenToOffPosition();
            }
        }

        if (m_currentTransitionState == TransitionState.MANUAL)
        {
            debugLine += " | Manual Control";
            float percentage = Mathf.Clamp01(eventArgs.WipeInfo.Progress);

            debugLine += ": " + percentage;
            transform.localPosition = Vector3.Lerp(m_from, m_to, percentage);

            // If we're sure of the gesture, just go make the transition
            if (percentage >= m_percentageToLockTransition)
            {
                debugLine += " | Transition Cofirmed";
                if (m_lastLockedState == TransitionState.OFF)
                {
                    TweenToOnPosition();
                }
                else
                {
                    TweenToOffPosition();
                }
            }
        }
        else if (m_currentTransitionState == TransitionState.TWEENING)
        {
            debugLine += " | Currently Tweening";
            //Debug.Log(debugLine);
            return;
        }
        else           // We're either on or off
        {
            debugLine += " | Locked";
            if (eventArgs.WipeInfo.Progress >= m_minProgressToStartTransition)
            {
                debugLine += " | Go To Manual";
                m_currentTransitionState = TransitionState.MANUAL;
            }
        }

        //Debug.Log(debugLine);
    }
Example #3
0
    private void onWipeUpdate(object sender, SystemWipeArgs eventArgs)
    {
        if ( !m_enabled ) { return; }

        string debugLine = "Debug";
        if ( eventArgs.WipeInfo.Status == Leap.Util.Status.SwipeAbort ) {
            debugLine += " | Abort";
            // If the user aborts, tween back to original location
            if ( m_lastLockedState == TransitionState.ON ) {
                TweenToOnPosition();
            }
            else {
                TweenToOffPosition();
            }
        }

        if ( m_currentTransitionState == TransitionState.MANUAL ) {

            debugLine += " | Manual Control";
            float fraction = Mathf.Clamp01(eventArgs.WipeInfo.Progress);

            debugLine += ": " + fraction;
            transform.localPosition = Vector3.Lerp(m_from, m_to, fraction);

            // If we're sure of the gesture, just go make the transition
            if ( fraction >= m_fractionToLockTransition ) {
                //debugLine += " | Transition Cofirmed";

                //THIS SECTION HAS BEEN MODIFIED TO FIT THE LEAP 3D JAM
                isSwiped = true;
                // luke added
                GameObject[] slimes = GameObject.FindGameObjectsWithTag ("Slime");
                foreach (GameObject slime in slimes) {
                    slime.SendMessage("ChangToARRandom");

                }

                //==================Yuyu and Luke added it=====================
                //Set the AR to be true in other two classes
                //RigidHand.AR_ = true;
                ApplyDamage.AR = true;

                //=========================End===============================
                //blinker.isBlinking = true;
                if ( m_lastLockedState == TransitionState.OFF) {
                    TweenToOnPosition();
                    blinker.isBlinking = true;
                    //BlinkQuadControl.isBlink = true;
                    Debug.Log("on position");
                    teleportController.Status = 1;
                    //IS_ON = true;
                }
                else {
                    //if(Blink.hasFinished)
                    //{
                    blinker.isBlinking = true;
                    TweenToOffPosition();
                    //BlinkQuadControl.isBlink = true;
                    teleportController.Status = 0;
                    Debug.Log("off position");
                    //IS_ON = false;
                    //}

                    //======================LUKE added==========================
                    ApplyDamage.AR = false;

                    foreach (GameObject slime in slimes) {
                        slime.SendMessage("ChangToVR");

                    }

                    //=========================End===============================
                }
            }else
                isSwiped = false; // else added by Danni
        }
        else if ( m_currentTransitionState == TransitionState.TWEENING ) {
            debugLine += " | Currently Tweening";
            //Debug.Log(debugLine);
            return;
        }
        else { // We're either on or off
            debugLine += " | Locked";
            if ( eventArgs.WipeInfo.Progress >= m_minProgressToStartTransition ) {
                debugLine += " | Go To Manual";
                m_currentTransitionState = TransitionState.MANUAL;
            }
        }

        Debug.Log(debugLine);
    }