Exemplo n.º 1
0
    //------------------------------------------------
    private void loadLevel()
    {
        Debug.Log("Next level loaded...");
        PG_OllyAnimations.changeTexture = true;
        ollyAnimationsSR.isAnimating    = true;
        ollyAnimationsSR.ollyState      = ollyAnimationStates.olly_idle1;

        totalAttempts        = 0;
        totalWrongAttempts   = 0;
        totalCorrects        = 0;
        jumpCount            = 0;
        countModeShapeNumber = 0;
        shapesTappedIndex    = -1;
        pgDataManager.fetchLevelData();
        showReferentBubble();
        pgDataManager.PG_generateQuestion();
        setIckyOllyInitialPosition();


        ickyAnimationsSR.isAnimating = true;
        ickyAnimationsSR.ickyState   = ickyAnimStates.icky_idle1;
        hardModeTime = pgDataManager.getHardModeTime();
        setDataUsingScriptRefrences();
        PG_OllyAnimations.answerShapesCount = pgDataManager.getAnswersListCount();
    }
    void getInitialSetupFromDM()
    {
        dataManager.NF_generateQuestion();
        availableShapes     = dataManager.getAvailableShapes();
        answersListCount    = dataManager.getAnswersListCount();
        questionTitle       = dataManager.getCorrectQuestionTitle();
        showReferent        = dataManager.getShowReferent();
        questionTitleToShow = dataManager.getQuestionTitle();
        gameModeDM          = dataManager.gameModeSwitching();
        questionIndexDM     = dataManager.getIndexOfCurrentPlayingQuestion();
        totalQuestionsDM    = dataManager.numberOfQuestionPresented();
        hardModeTime        = dataManager.getHardModeTime();

        if (changeBackground == true)
        {
            int backgroundIndex = Random.Range(0, backgroundsCount);
            backgroundImage = backgroundArray[backgroundIndex];
            foregroundImage = foregroundArray[backgroundIndex];
            frontLayerImage = frontLayerArray[backgroundIndex];

            // set background at random whenever new level is loaded
            background.renderer.material.mainTexture = Resources.Load(NF_Constants._backgroundsPath + backgroundImage) as Texture;
            foreground.renderer.material.mainTexture = Resources.Load(NF_Constants._backgroundsPath + foregroundImage) as Texture;
            frontLayer.renderer.material.mainTexture = Resources.Load(NF_Constants._backgroundsPath + frontLayerImage) as Texture;
        }
        Debug.Log("GC_QuestionLoaded:  " + questionTitle);
        questionLoader.questionInitializer(questionIndexDM, questionTitleToShow, currentCategoryID, gameModeDM, answersListCount, showReferent, questionTitle); // setup question elements
        ropesGenerator.generateRopeForQuestion(totalQuestionsDM, questionTitle, availableShapes, currentCategoryID, gameModeDM, questionTitleToShow);           // generate Ropes
        GameObject correctRope = ropesGenerator.getCorrectRope();

        inputController.inputControllerInitializer(questionTitleToShow, questionTitle, correctRope, answersListCount, currentCategoryID);

        // check hardMode here
//	if(hardModeTime>0){
//		Invoke("createMonkeys",hardModeTime);
//		}

        // call olly creation
        Invoke("createOllyModel", ollyCreationTime);
    }