Ejemplo n.º 1
0
    private void HandleEvent(TutorialEvent tutorialEvent)
    {
        switch (tutorialEvent)
        {
        case TutorialEvent.NONE:
            break;

        case TutorialEvent.LOAD_PRESET_LEVEL:
            LevelSelectGUI.currentLevel = Levels.GetLevel(level);
            Loading.Load(level);
            break;

        case TutorialEvent.LOAD_NEXT_LEVEL:
            LoadLevel.LoadALevel("next");
            break;

        case TutorialEvent.START_PLAYER:
            tutorialEnabled = false;

            // Disable buttons
            lastButton.interactable = false;
            nextButton.interactable = false;
            skipButton.interactable = false;

            // Get rid of mainCamera tag
            //tag = "Untagged";

            // Unfreeze camera
            {
                //theCamera.active = true;
                theCamera.GetComponent <LevelStart>().Start();
            }

            // Unfreeze player
            GameObject player = GameObject.Find("Player");
            if (player != null)
            {
                player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
            }

            // Disable tutorial camera
            //gameObject.active = false;
            this.enabled = false;
            break;

        case TutorialEvent.PLAY_RECORDING:
            string       test = "Recordings/" + points[index].recordingName;
            TextAsset    ta   = (TextAsset)Resources.Load(test);
            Stream       s    = new MemoryStream(ta.bytes);
            BinaryReader br   = new BinaryReader(s);
            GameRecorder.StartPlaybackTutorial(Recording.Read(br));
            break;

        case TutorialEvent.RESET_PLAYER:
            GameRecorder.StopPlayback();
            GameObject.Find("Player").BroadcastMessage("Reload");
            break;
        }
    }