Ejemplo n.º 1
0
    private void Update()
    {
        // The initial state is manipulation. Manipulation moves stuff. Navigation rotates stuff.
        if (Time.time > timeToCheck)
        {
            if (navigationGestureScript == null)
            {
                // localPlayer should have been set by 18 seconds by the PlayerController script.
                // so we set the navigationGestureScript.
                navigationGestureScript = localPlayer.GetComponent <NavigationGestureOn>();
            }
            else
            {
                // The next frame after navigationGestureScript is set, say that localPlayerFound is true.
                localPlayerFound = true;
            }

            if (localPlayerFound && !initialNavigationGestureDisableDone)
            {
                navigationGestureScript.enabled = false;
                // initialNavigationGestureDisableDone. We disabled the navigationGestureScript, so now we say hey it's done.
                // Now, when the update function happens again, this conditional will not succeed.
                // We just want to disable the navigation script once, so that the manipulation script can do its business alone.
                initialNavigationGestureDisableDone = true;
            }
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Air tap will switch from Manipulation to Navigation and vice versa.
    /// </summary>
    public void SwitchGestures()
    {
        ManipulationGestureOn manipulationGestureScript = localPlayer.GetComponent <ManipulationGestureOn>();
        NavigationGestureOn   navigationGestureScript   = localPlayer.GetComponent <NavigationGestureOn>();

        if (!navigationGestureScript.enabled)
        {
            manipulationGestureScript.enabled = false;
            navigationGestureScript.enabled   = true;
            Debug.Log("SWITCH TO NAVIGATION.");
        }
        else if (!manipulationGestureScript.enabled)
        {
            navigationGestureScript.enabled   = false;
            manipulationGestureScript.enabled = true;
            Debug.Log("SWITCH TO MANIPULATION");
        }
    }