public void StartLevel(LevelInput _levelInput)
    {
        //Call this immediately after loading the scene. Pass the LevelInput, and the level will start with those values.
        m_levelInput = _levelInput;
        FQ_FoodLineupHandler.inst.PopulateFoodList();
        //ND_RobotHandler.inst.SetWantedFoods();
        //ND_LevelTimer.inst.SetupTimer();

        //Start the intro dialogue if it exists and isn't set to be skipped, else start the drop game.
        if ((FindSceneInfo() == null) || (!FindSceneInfo()[0].GetComponent <SceneInfo>().m_skipIntro))
        {
            if (FindDialogue(DIALOGUETYPE.FQ_INTRO, -1, false) != null)
            {
                DialogueManager.inst.ToggleSpeechBubble(SpeechBubble.SPEECHBUBBLETYPE.ROBOT, false);
                DialogueManager.inst.StartConversation(FindDialogue(DIALOGUETYPE.FQ_INTRO), SpeechBubble.SPEECHBUBBLETYPE.ASSISTANT);
            }
            else
            {
                StartGame();
            }
        }
        else
        {
            StartGame();
        }
    }
Пример #2
0
        void ReleaseDesignerOutlets()
        {
            if (Calc != null)
            {
                Calc.Dispose();
                Calc = null;
            }

            if (Calc != null)
            {
                Calc.Dispose();
                Calc = null;
            }

            if (ItemUsed != null)
            {
                ItemUsed.Dispose();
                ItemUsed = null;
            }

            if (LevelInput != null)
            {
                LevelInput.Dispose();
                LevelInput = null;
            }

            if (ResultsLabel != null)
            {
                ResultsLabel.Dispose();
                ResultsLabel = null;
            }
        }
Пример #3
0
 private void InitListener()
 {
     GameObject inputgo = new GameObject("InputListener");
     levelInput = inputgo.AddComponent<LevelInput>();
     levelInput.AddEventListener(LevelInputEvent.TouchStart, TouchStartHandler);
     levelInput.AddEventListener(LevelInputEvent.TouchEnd, TouchEndHandler);
     levelInput.AddEventListener(LevelInputEvent.TouchClick, TouchClickHandler);
     levelInput.AddEventListener(LevelInputEvent.Key, KeyHandler);
 }
Пример #4
0
 public void Copy(LevelInput _base)
 {
     //Copy over level input settings.
     m_levelType          = _base.m_levelType;
     m_foodDropLevelInput = _base.m_foodDropLevelInput;
     m_foodQuizLevelInput = _base.m_foodQuizLevelInput;
     m_levelStatus        = _base.m_levelStatus;
     m_levelRating        = _base.m_levelRating;
     m_levelName          = _base.m_levelName;
 }
Пример #5
0
    private void InitListener()
    {
        GameObject inputgo = new GameObject("InputListener");

        levelInput = inputgo.AddComponent <LevelInput>();
        levelInput.AddEventListener(LevelInputEvent.TouchStart, TouchStartHandler);
        levelInput.AddEventListener(LevelInputEvent.TouchEnd, TouchEndHandler);
        levelInput.AddEventListener(LevelInputEvent.TouchClick, TouchClickHandler);
        levelInput.AddEventListener(LevelInputEvent.Key, KeyHandler);
    }
    public void StartLevel(LevelInput _levelInput)
    {
        //Call this immediately after loading the scene. Pass the LevelInput, and the level will start with those values.
        m_levelInput = _levelInput;
        NutrientBucket.inst.Pause();
        NutrientSpawner.inst.Pause();
        NutrientSpawner.inst.SetSpawnerInfo(m_levelInput.m_foodDropLevelInput.m_spawnerInfo);
        ND_RobotHandler.inst.SetWantedFoods();
        ND_LevelTimer.inst.SetupTimer();
        m_pauseMenu.RequestPause();

        //Tell the food database which tab it should open to.
        switch (m_levelInput.m_levelName)
        {
        case "Grains":
            LogManager.activeTab = LogManager.TabType.Grain;
            break;

        case "Drinks":
            LogManager.activeTab = LogManager.TabType.Drink;
            break;

        case "MeatAlternatives":
            LogManager.activeTab = LogManager.TabType.MeatAlts;
            break;

        default:
            LogManager.activeTab = LogManager.TabType.Grain;
            break;
        }
        LogDatabase.ClearItemsCollected();

        //Start the intro dialogue if it exists and isn't set to be skipped, else start the drop game.
        if ((FindSceneInfo() == null) || (!FindSceneInfo()[0].GetComponent <SceneInfo>().m_skipIntro))
        {
            if (FindDialogue(DIALOGUETYPE.FD_INTRO, false) != null)
            {
                DialogueManager.inst.StartConversation(FindDialogue(DIALOGUETYPE.FD_INTRO), SpeechBubble.SPEECHBUBBLETYPE.ASSISTANT);
                m_animDialogue.SetTrigger("Go_BottomIn");
            }
            else
            {
                StartDropGame();
            }
        }
        else
        {
            StartDropGame();
        }
    }
Пример #7
0
    public void UpdateLevel(LevelInput _levelInput)
    {
        //Update an existing level's information based on PassedLevelInput from a previous scene.
        //Debug.Log("LS_Levels.UpdateLevel for level with name \""+_levelInput.m_levelName+"\".");

        for (int i = 0; i < m_levels.Count; i++)
        {
            if (m_levels[i].m_levelName == _levelInput.m_levelName)
            {
                m_levels[i].m_levelRating = _levelInput.m_levelRating;
                m_levels[i].m_levelStatus = _levelInput.m_levelStatus;
            }
        }

        //Destroy the PassedLevelInfo.
        DestroyImmediate(_levelInput.gameObject);
    }
    public void StartLevel(LevelInput _levelInput)
    {
        //Move on to the Food Drop game with the _levelInput.
        m_levelInputObject.AddComponent <LevelInput>();
        m_levelInputObject.GetComponent <LevelInput>().Copy(_levelInput);

        LEVELTYPE _levelType = m_levelInputObject.GetComponent <LevelInput>().m_levelType;

        if ((_levelType == LEVELTYPE.FOODDROP) || (_levelType == LEVELTYPE.BOTH))
        {
            LevelLoading.Instance.LoadScene("FoodDrop_RS");
        }
        else if (_levelType == LEVELTYPE.FOODQUIZ)
        {
            LevelLoading.Instance.LoadScene("FoodQuiz");
        }
    }
    public void SetButton(GameObject _button, LevelInput _info)
    {
        //Set a button's name, image, and star rating.

        //Button's name.
        _button.transform.GetChild(0).gameObject.GetComponent <Text>().text = _info.m_levelName;

        //Button's image.
        if (_info.m_levelStatus == LEVELSTATUS.UNAVAILABLE)
        {
            _button.GetComponent <Image>().sprite = m_levelBoxes[0];
        }
        else if (_info.m_levelStatus == LEVELSTATUS.AVAILABLE)
        {
            _button.GetComponent <Image>().sprite = m_levelBoxes[1];
        }
        else if (_info.m_levelStatus == LEVELSTATUS.COMPLETE)
        {
            _button.GetComponent <Image>().sprite = m_levelBoxes[2];
        }

        //Stars.
        if (_info.m_levelRating == LEVELRATING.NONE)
        {
            _button.transform.GetChild(1).gameObject.GetComponent <Image>().sprite = m_levelStars[0];
        }
        else if (_info.m_levelRating == LEVELRATING.STAR1)
        {
            _button.transform.GetChild(1).gameObject.GetComponent <Image>().sprite = m_levelStars[1];
        }
        else if (_info.m_levelRating == LEVELRATING.STAR2)
        {
            _button.transform.GetChild(1).gameObject.GetComponent <Image>().sprite = m_levelStars[2];
        }
        else if (_info.m_levelRating == LEVELRATING.STAR3)
        {
            _button.transform.GetChild(1).gameObject.GetComponent <Image>().sprite = m_levelStars[3];
        }
    }