Ejemplo n.º 1
0
    private void ConfigureFirstStep()
    {
        CurrentStepObject = Instantiate(LevelSteps[0]);
        CurrentStep       = CurrentStepObject.GetComponent <AddressingStep>();
        CurrentStepObject.transform.parent = this.transform;

        PlaceInBox(CurrentStepObject);
        IncorrectCircles = LoadGrayNotes(CurrentStepObject, CurrentStep, out CorrectCircle);

        firstNoteHeight = CurrentStep.FirstNoteCollider.bounds.center.y;

        //if (((levelNumber == 3) || (levelNumber == 4)) ||
        //      ((levelNumber == 5 || levelNumber == 6) && (Random.value < 0.5f)))
        //{
        //    SuperdogText.text = "Swing to the note " +
        //        GetDifferential(CurrentStep.StartNote, CurrentStep.Notes[CurrentStep.CorrectIndex]) +
        //        " the note you're hanging from!";
        //}
        //else
        //{
        //    SuperdogText.text = "Swing to the " + CurrentStep.Notes[CurrentStep.CorrectIndex] + "!";
        //}

        if (!IsFirstLevel && LevelSelection.IsAutoplaying())
        {
            CorrectCircleClicked(CorrectCircle);
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            this.CompleteLevel();
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            this.hero.Caffeinate(5f);
            this.autoplay = true;
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            this.autoplay = !this.autoplay;
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            this.hero.Caffeinate();
        }

        if (this.autoplay || Input.GetKeyDown(KeyCode.M))
        {
            this.AutoMatch();
        }

        this.autoplay = this.autoplay || LevelSelection.IsAutoplaying();
    }
Ejemplo n.º 3
0
    private IEnumerator Tutorial()
    {
        if (TutorialIndex == TutorialMessages.Length)
        {
            SuperdogButton.gameObject.SetActive(false);
            StartCoroutine(Transition.TransitionBrightness(gameObject, Superdog, tutorialFadeTime, Dark, Bright));
            yield return(Transition.FadeOut(SuperdogText.gameObject, tutorialFadeTime, false));

            SuperdogText.text = "Swing to the " + CurrentStep.Notes[CurrentStep.CorrectIndex] + "!";
            yield return(Transition.FadeIn(SuperdogText.gameObject, tutorialFadeTime, false));

            if (LevelSelection.IsAutoplaying())
            {
                CorrectCircleClicked(CorrectCircle);
            }
        }
        else if (TutorialIndex == 0)
        {
            SuperdogDialogue.SetActive(true);
            SuperdogButton.gameObject.SetActive(true);
            SuperdogText.text = TutorialMessages[TutorialIndex++];
            InTutorial        = true;
            StartCoroutine(Transition.FadeIn(SuperdogDialogue, tutorialFadeTime, false));
            yield return(Transition.TransitionBrightness(gameObject, Superdog, tutorialFadeTime, Bright, Dark));

            if (LevelSelection.IsAutoplaying())
            {
                TutorialNextButtonPressed();
            }
        }
        else
        {
            SuperdogButton.gameObject.SetActive(false);
            yield return(Transition.FadeOut(SuperdogText.gameObject, tutorialFadeTime, false));

            SuperdogText.text = TutorialMessages[TutorialIndex++];
            if (TutorialIndex == 3)
            {
                StartCoroutine(Transition.TransitionBrightness(CurrentStepObject, null, tutorialFadeTime, Dark, Bright));
            }
            else if (TutorialIndex == 4)
            {
                StartCoroutine(Transition.TransitionBrightness(CurrentStepObject, null, tutorialFadeTime, Bright, Dark));
            }
            yield return(Transition.FadeIn(SuperdogText.gameObject, tutorialFadeTime, false));

            yield return(new WaitForSeconds(tutorialFadeTime));

            if (TutorialIndex == TutorialMessages.Length)
            {
                SuperdogButton.GetComponentInChildren <Text>().text = "Let's go!";
            }
            SuperdogButton.gameObject.SetActive(true);
            if (LevelSelection.IsAutoplaying())
            {
                TutorialNextButtonPressed();
            }
        }
    }
Ejemplo n.º 4
0
    public IEnumerator BonusLevel(uint bonusIndex)
    {
        Logger.Instance.LogAction("BonusLevel", "Start", bonusIndex.ToString());
        LoadOptions(BonusLevels[bonusIndex]);

        ShowObject(this.gameObject);

        HearBox1Initial = HearBox1.transform.localPosition;
        HearBox2Initial = HearBox2.transform.localPosition;
        SeeBox1Initial  = SeeBox1.transform.localPosition;
        SeeBox2Initial  = SeeBox2.transform.localPosition;

        bool showLowerUI = (TutorialOverlay == null);

        HearBox1.SetActive(showLowerUI);
        HearBox2.SetActive(showLowerUI);
        SeeBox1.SetActive(showLowerUI);
        SeeBox2.SetActive(showLowerUI);
        Captions.SetActive(showLowerUI);

        HideObject(HearBubbles);
        HideObject(SeeBubbles);
        HideObject(SelectionPane);
        HideObject(GlowCloud);

        SeeBox1.GetComponentInChildren <SpriteRenderer>().enabled  = false;
        SeeBox2.GetComponentInChildren <SpriteRenderer>().enabled  = false;
        HearBox1.GetComponentInChildren <SpriteRenderer>().enabled = false;
        HearBox2.GetComponentInChildren <SpriteRenderer>().enabled = false;

        Selection.MusicSelectionMade = false;
        Selection.StorySelectionMade = false;

        yield return(Show());

        if (LevelSelection.IsAutoplaying())
        {
            yield return(new WaitForSeconds(0.4f));

            DismissTutorialOverlay();
            yield return(new WaitForSeconds(0.4f));

            SelectMusic(1 + (int)(2 * Random.value));
            yield return(new WaitForSeconds(0.4f));

            SelectStory(1 + (int)(2 * Random.value));
        }

        yield return(new WaitUntil(SelectionMade));

        Captions.SetActive(false);
        yield return(ShowSelection());

        yield return(Hide());
    }
Ejemplo n.º 5
0
    private IEnumerator ConfigureFirstStep()
    {
        CurrentStepObject = Instantiate(LevelSteps[0]);
        CurrentStep       = CurrentStepObject.GetComponent <AddressingStep>();
        CurrentStepObject.transform.parent = this.transform;

        PlaceInBox(CurrentStepObject);
        IncorrectCircles = LoadGrayNotes(CurrentStepObject, CurrentStep, out CorrectCircle);

        firstNoteHeight = CurrentStep.FirstNoteCollider.bounds.center.y;

        SuperdogText.text = "Swing to the " + CurrentStep.Notes[CurrentStep.CorrectIndex] + "!";
        yield return(Transition.FadeIn(SuperdogText.gameObject, tutorialFadeTime, false));

        if (!IsFirstLevel && LevelSelection.IsAutoplaying())
        {
            CorrectCircleClicked(CorrectCircle);
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.U) && Input.GetKey(KeyCode.T) && Input.GetKey(KeyCode.O))
        {
            Debug.Log("Autoplay Beginning at " + System.DateTime.Now.ToUniversalTime());
            LevelSelection.BeginAutoplay();
        }

        if (LevelSelection.IsAutoplaying())
        {
            switch (SceneManager.GetActiveScene().name /* Application.loadedLevelName */)
            {
            case "TitleScene":
                ManualChangeScene("IntroCutscene1");
                break;

            case "IntroCutscene1":
                ManualChangeScene("IntroCutscene2");
                break;

            case "IntroCutscene2":
                ManualChangeScene("IntroCutscene3");
                break;

            case "IntroCutscene3":
                ManualChangeScene("IntroCutscene4");
                break;

            case "IntroCutscene4":
                ManualChangeScene("LetsGoScene");
                break;

            case "LetsGoScene":
                ManualChangeScene("LevelSelection");
                break;

            default:
                Debug.Log(SceneManager.GetActiveScene().name /* Application.loadedLevelName */);
                break;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (LevelSelection.IsAutoplaying())
        {
            switch (SceneManager.GetActiveScene().name /* Application.loadedLevelName */)
            {
            case "TitleScene":
                ManualChangeScene("IntroCutscene1");
                break;

            case "IntroCutscene1":
                ManualChangeScene("IntroCutscene2");
                break;

            case "IntroCutscene2":
                ManualChangeScene("IntroCutscene3");
                break;

            case "IntroCutscene3":
                ManualChangeScene("IntroCutscene4");
                break;

            case "IntroCutscene4":
                ManualChangeScene("LetsGoScene");
                break;

            case "LetsGoScene":
                ManualChangeScene("Jungle");
                break;

            default:
                //Debug.Log(SceneManager.GetActiveScene().name /* Application.loadedLevelName */);
                break;
            }
        }
    }
Ejemplo n.º 8
0
    private IEnumerator LoadNextStep(GrayCircle circ)
    {
        Debug.Log("loading next step" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        hintController.HideHint();
        HintDisplayed = false;

        bool isLastLevel;

        GameObject[]   nextIncorrect;
        AddressingStep OldStep       = CurrentStep;
        GameObject     OldStepObject = CurrentStepObject;
        GameObject     NewStepObject = Instantiate(LevelSteps[stepsCompleted]);
        AddressingStep NextStep      = NewStepObject.GetComponent <AddressingStep>();
        GrayCircle     NextCorrect   = null;

        isLastLevel = NextStep.Notes.Length == 0;
        NewStepObject.transform.parent = this.transform;
        TransitioningBackgrounds       = true;

        Debug.Log("transitioningBackgrounds set to True" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        if (OldStep.TutorialObject != null)
        {
            Destroy(OldStep.TutorialObject);
            Debug.Log("Destroyed OldStep.TutorialObject" + " and transitionbackgrounds is " + TransitioningBackgrounds);
        }

        //PlaceInBox(NewStepObject);

        float currentNoteBoxHeight = OldStep.NotesBox.bounds.size.y;
        float newNoteBoxHeight     = NextStep.NotesBox.bounds.size.y;

        NewStepObject.transform.localScale *= (currentNoteBoxHeight / newNoteBoxHeight);
        Vector3 positionDeltaY = Vector3.up * (OldStep.NotesBox.bounds.center.y - NextStep.NotesBox.bounds.center.y);

        NewStepObject.transform.position += positionDeltaY;

        if (!isLastLevel)
        {
            nextIncorrect = LoadGrayNotes(NewStepObject, NextStep, out NextCorrect);
        }
        else
        {
            nextIncorrect = new GameObject[0];
        }

        Vector3 offset      = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - NextStep.FirstNoteCollider.bounds.center);
        Vector3 finalOffset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - OldStep.FirstNoteCollider.bounds.center);

        NewStepObject.transform.position += offset;

        OldStepObject.transform.position += Vector3.forward * 0.2f;

        SuperdogDialogue.SetActive(false);

        Debug.Log("Placed new object in box, deactivated Superdog" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        // Stage 1: "Swap"
        StartCoroutine(Transition.FadeOut(IncorrectCircles, swaptime, Transition.FinishType.Destroy));
        StartCoroutine(Transition.FadeOut(circ.gameObject, swaptime));
        if (NextStep.TutorialAlpha != null)
        {
            NextStep.TutorialAlpha.SetActive(false);
        }
        StartCoroutine(Transition.FadeIn(NewStepObject, swaptime, exclude: NextStep.TutorialAlpha));
        //yield return Transition.Rotate(SupergirlArm.transform, swaptime / 2, 0f, 160f);

        Debug.Log("Finished swap" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        // Stage 1.5: Throw vine
        SupergirlVineCurled.SetActive(false);
        SupergirlAnimator.SetTrigger("noteClicked"); // Trigger vine throwing animation
        yield return(vineController.ThrowVine(ThrowingVine, SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 2));

        Audio.PlayNote(CurrentStep.Notes[CurrentStep.CorrectIndex]);

        Debug.Log("Vine thrown" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        if (circ != null)
        {
            Destroy(circ.gameObject);
        }


        Debug.Log("circle destroyed" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        CurrentStep       = NextStep;
        CurrentStepObject = NewStepObject;
        IncorrectCircles  = nextIncorrect;
        CorrectCircle     = NextCorrect;

        Debug.Log("Switched all the variables" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        if (!isLastLevel)
        {
            StartCoroutine(TransitionBackgrounds());
            StartCoroutine(Transition.Translate(CurrentStepObject.transform, CurrentStepObject.transform.position - finalOffset, flytime));
            StartCoroutine(superdogController.FlySuperdog(flytime));
        }
        else
        {
            StartCoroutine(Transition.Translate(CurrentStepObject.transform, Vector3.Scale(CurrentStepObject.transform.position, new Vector3(0f, 1f, 1f)), flytime));
        }
        StartCoroutine(Transition.FadeOut(OldStepObject, flytime));
        StartCoroutine(Transition.Translate(OldStepObject.transform, OldStepObject.transform.position - finalOffset, flytime));
        SupergirlVineCurled.SetActive(true);
        StartCoroutine(Transition.Rotate(SupergirlArm.transform, flytime, 160f, 0f));

        yield return(new WaitForSeconds(flytime + 0.2f));

        Debug.Log("Supergirl has flown" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        TransitioningBackgrounds = false;

        Debug.Log("transitioningBackgrounds set to False" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        if (!isLastLevel)
        {
            SuperdogDialogue.SetActive(true);
            dialogueController.updateDialogue(TutorialIndex++);

            Debug.Log("Superdog reactivated" + " and transitionbackgrounds is " + TransitioningBackgrounds);
        }

        Destroy(OldStepObject);

        Debug.Log("Old step object destroyed" + " and transitionbackgrounds is " + TransitioningBackgrounds);

        if (NextStep.TutorialAlpha != null)
        {
            NextStep.TutorialAlpha.SetActive(true);
        }

        if (isLastLevel)
        {
            yield return(CompleteLevel());
        }
        else if (LevelSelection.IsAutoplaying())
        {
            CorrectCircleClicked(CorrectCircle);
            Debug.Log("Called CorrectCircleClicked" + " and transitionbackgrounds is " + TransitioningBackgrounds);
        }
    }
Ejemplo n.º 9
0
    private IEnumerator Tutorial()
    {
        if (TutorialIndex == dialogueController.tutorialLength) // ONCE TUTORIAL MESSAGES ARE FINISHED
        {
            InTutorial = false;

            SuperdogButton.gameObject.SetActive(false);                                                            //keep
            StartCoroutine(Transition.TransitionBrightness(gameObject, Superdog, tutorialFadeTime, Dark, Bright)); //keep
            //yield return Transition.FadeOut(SuperdogText.gameObject, tutorialFadeTime); //keep
            //if (CurrentStep.TutorialObject == null)
            //{
            //    SuperdogText.text = "Swing to the " + CurrentStep.Notes[CurrentStep.CorrectIndex] + "!";
            //} else
            //{
            //    SuperdogText.text = CurrentStep.TutorialSuperdogText;
            //}
            dialogueController.updateDialogue(TutorialIndex++);

            if (LevelSelection.IsAutoplaying())
            {
                CorrectCircleClicked(CorrectCircle);
            }
            if (CurrentStep.TutorialObject != null)
            {
                CurrentStep.TutorialObject.SetActive(true);
            }
            TransitioningBackgrounds = false;
            ShowLives();
        }

        else if (TutorialIndex == 0) //first step of tutorial
        {
            TransitioningBackgrounds = true;
            HideLives();

            // TutorialObject is the arrows on the staff. This block hides it (since step 1 will have it and we don't want it shown while he's talkin)
            if (CurrentStep.TutorialObject != null)
            {
                CurrentStep.TutorialObject.SetActive(false);
            }

            SuperdogDialogue.SetActive(true);
            dialogueController.updateDialogue(TutorialIndex++);

            SuperdogButton.gameObject.SetActive(true);
            //SuperdogText.text = TutorialMessages[TutorialIndex++];
            InTutorial = true;
            StartCoroutine(Transition.FadeIn(SuperdogDialogue, tutorialFadeTime, false));
            yield return(Transition.TransitionBrightness(gameObject, Superdog, tutorialFadeTime, Bright, Dark));

            if (LevelSelection.IsAutoplaying())
            {
                TutorialNextButtonPressed();
            }
        }

        else   //other tutorial steps
        {
            SuperdogButton.gameObject.SetActive(false);
            // yield return Transition.FadeOut(SuperdogText.gameObject, tutorialFadeTime);
            dialogueController.updateDialogue(TutorialIndex++);

            // This block dictates when the staff will be brightened/darkened
            // PRESERVE FUNCTIONALITY
            if (TutorialIndex == 3)
            {
                StartCoroutine(Transition.TransitionBrightness(CurrentStepObject, null, tutorialFadeTime, Dark, Bright));
            }
            else if (TutorialIndex == 8)
            {
                StartCoroutine(Transition.TransitionBrightness(CurrentStepObject, null, tutorialFadeTime, Bright, Dark));
            }

            yield return(new WaitForSeconds(tutorialFadeTime));

            if (TutorialIndex == dialogueController.tutorialLength)
            {
                SuperdogButton.GetComponentInChildren <Text>().text = "Let's go!";
            }
            SuperdogButton.gameObject.SetActive(true);
            if (LevelSelection.IsAutoplaying())
            {
                TutorialNextButtonPressed();
            }
        }
    }
Ejemplo n.º 10
0
    private IEnumerator LoadNextStep(GrayCircle circ)
    {
        bool isLastLevel;

        GameObject[]   nextIncorrect;
        AddressingStep OldStep       = CurrentStep;
        GameObject     OldStepObject = CurrentStepObject;
        GameObject     NewStepObject = Instantiate(LevelSteps[stepsCompleted]);
        AddressingStep NextStep      = NewStepObject.GetComponent <AddressingStep>();
        GrayCircle     NextCorrect   = null;

        isLastLevel = NextStep.Notes.Length == 0;
        NewStepObject.transform.parent = this.transform;
        TransitioningBackgrounds       = true;

        //PlaceInBox(NewStepObject);

        float currentNoteBoxHeight = OldStep.NotesBox.bounds.size.y;
        float newNoteBoxHeight     = NextStep.NotesBox.bounds.size.y;

        NewStepObject.transform.localScale *= (currentNoteBoxHeight / newNoteBoxHeight);
        Vector3 positionDeltaY = Vector3.up * (OldStep.NotesBox.bounds.center.y - NextStep.NotesBox.bounds.center.y);

        NewStepObject.transform.position += positionDeltaY;

        if (!isLastLevel)
        {
            nextIncorrect = LoadGrayNotes(NewStepObject, NextStep, out NextCorrect);
        }
        else
        {
            nextIncorrect = new GameObject[0];
        }

        Vector3 offset      = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - NextStep.FirstNoteCollider.bounds.center);
        Vector3 finalOffset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - OldStep.FirstNoteCollider.bounds.center);

        NewStepObject.transform.position += offset;

        OldStepObject.transform.position += Vector3.forward * 0.2f;

        SuperdogDialogue.SetActive(false);
        if (!isLastLevel)
        {
            SuperdogText.text = "Swing to the " + NextStep.Notes[NextStep.CorrectIndex] + "!";
        }

        // Stage 1: "Swap"
        StartCoroutine(Transition.FadeOut(IncorrectCircles, swaptime, Transition.FinishType.Destroy));
        StartCoroutine(Transition.FadeOut(circ.gameObject, swaptime, false));
        StartCoroutine(Transition.FadeIn(NewStepObject, swaptime, false));
        yield return(Transition.Rotate(SupergirlArm.transform, swaptime / 2, 0f, 160f));

        // Stage 1.5: Throw vine
        SupergirlVineCurled.SetActive(false);
        yield return(ThrowVine(SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 2));

        Destroy(circ.gameObject);

        CurrentStep       = NextStep;
        CurrentStepObject = NewStepObject;
        IncorrectCircles  = nextIncorrect;
        CorrectCircle     = NextCorrect;

        if (!isLastLevel)
        {
            StartCoroutine(TransitionBackgrounds());
            StartCoroutine(Transition.Translate(CurrentStepObject.transform, CurrentStepObject.transform.position - finalOffset, flytime));
            StartCoroutine(FlySuperdog(flytime));
        }
        else
        {
            StartCoroutine(Transition.Translate(CurrentStepObject.transform, Vector3.Scale(CurrentStepObject.transform.position, new Vector3(0f, 1f, 1f)), flytime));
            StartCoroutine(FlySuperdogAway(flytime));
        }
        StartCoroutine(Transition.FadeOut(OldStepObject, flytime, false));
        StartCoroutine(Transition.Translate(OldStepObject.transform, OldStepObject.transform.position - finalOffset, flytime));
        SupergirlVineCurled.SetActive(true);
        StartCoroutine(Transition.Rotate(SupergirlArm.transform, flytime, 160f, 0f));

        yield return(new WaitForSeconds(flytime + 0.2f));

        TransitioningBackgrounds = false;

        if (!isLastLevel)
        {
            SuperdogDialogue.SetActive(true);
        }

        Destroy(OldStepObject);

        if (isLastLevel)
        {
            yield return(CompleteLevel());
        }
        else if (LevelSelection.IsAutoplaying())
        {
            CorrectCircleClicked(CorrectCircle);
        }
    }