Exemplo n.º 1
0
    public void navigateTo(NavigatorScene newScene, Dictionary <string, object> newBundle = null, bool immediate = false)
    {
        // Navigates to a gameobject with the camera
        //Debug.Log("navigating to " + gameObject + " @ " + gameObject.transform.position);

        if (!isNavigating && newScene != null && newScene.cameraTarget != null && newScene != currentScene)
        {
            //* .call(() => logDone("over"))

            // Initializations
            newScene.initialize(newBundle);

            if (immediate)
            {
                // Immediately show it
                if (currentScene != null)
                {
                    currentScene.onStartedHiding();
                }
                newScene.onStartedShowing();
                Camera.main.gameObject.transform.position = newScene.cameraTarget.transform.position;
                if (currentScene != null)
                {
                    currentScene.onFinishedHiding();
                }
                newScene.onFinishedShowing();
            }
            else
            {
                // Animate to it
                // Create tween
                var tween = ZTween.use(Camera.main.gameObject);

                // Call start functions
                if (currentScene != null)
                {
                    tween.call(currentScene.onStartedHiding);
                }
                tween.call(newScene.onStartedShowing);

                // Animate
                tween.moveTo(newScene.cameraTarget.transform.position, 0.4f, Easing.backInOut);

                // Call ending functions
                if (currentScene != null)
                {
                    tween.call(currentScene.onFinishedHiding);
                }
                tween.call(newScene.onFinishedShowing);

                // Play the tween
                tween.play();                //.wait(1).call(Func).set("visible", false).play();
            }

            currentScene = newScene;
        }
    }
Exemplo n.º 2
0
	public void navigateTo(NavigatorScene newScene, Dictionary<string, object> newBundle = null, bool immediate = false) {
		// Navigates to a gameobject with the camera
		//Debug.Log("navigating to " + gameObject + " @ " + gameObject.transform.position);

		if (!isNavigating && newScene != null && newScene.cameraTarget != null && newScene != currentScene) {
			//* .call(() => logDone("over"))

			// Initializations
			newScene.initialize(newBundle);

			if (immediate) {
				// Immediately show it
				if (currentScene != null) currentScene.onStartedHiding();
				newScene.onStartedShowing();
				Camera.main.gameObject.transform.position = newScene.cameraTarget.transform.position;
				if (currentScene != null) currentScene.onFinishedHiding();
				newScene.onFinishedShowing();
			} else {
				// Animate to it
				// Create tween
				var tween = ZTween.use(Camera.main.gameObject);

				// Call start functions
				if (currentScene != null) tween.call(currentScene.onStartedHiding);
				tween.call(newScene.onStartedShowing);

				// Animate
				tween.moveTo(newScene.cameraTarget.transform.position, 0.4f, Easing.backInOut);

				// Call ending functions
				if (currentScene != null) tween.call(currentScene.onFinishedHiding);
				tween.call(newScene.onFinishedShowing);
			
				// Play the tween
				tween.play();//.wait(1).call(Func).set("visible", false).play();
			}

			currentScene = newScene;
		}
	}