示例#1
0
    void Awake()
    {
        statsMeta = new SingleGameStatsMeta();
        statsMeta.DifficultyFactor = 0.3f;
        statsMeta.NTargetChecks    = 1;
        cameraController           = GameObject.FindGameObjectWithTag(Tags.MAIN_CAMERA).GetComponent <CameraController> ();
        stackGenerator             = new GameStacksBuilder();
        prefabsManager             = GameObject.FindGameObjectWithTag(Tags.PREFABS_MANAGER).GetComponent <PrefabsManager> ();

        blur         = cameraController.GetComponent <BlurOptimized> ();
        blur.enabled = false;

        GameStacks gamestacks = stackGenerator.BuildGameStacks(ApplicationModel.stackMetaPair, prefabsManager);

        statsMeta.MaxFlips = gamestacks.MaxFlips + (int)(Mathf.Max(gamestacks.Target.Meta.ChipCount() * statsMeta.DifficultyFactor, 1));
        targetStack        = gamestacks.Target;
        targetStack.AddListener(this);

        hud = GameObject.FindGameObjectWithTag(Tags.HUD).GetComponent <StatisticsController>();
        hud.SetNFlips(statsMeta.MaxFlips);
        hudController = hud.GetComponent <HUDController> ();

        pauseMenu = GameObject.FindGameObjectWithTag(Tags.PAUSE_MENU).GetComponent <StatisticsController> ();
        pauseMenu.SetNFlipsLeft(statsMeta.MaxFlips);
        pauseMenu.SetNTargetChecks(1);
        pauseMenu.SetTime(0f);

        gameOverMenu = GameObject.FindGameObjectWithTag(Tags.GAME_OVER_MENU).GetComponent <StatisticsController> ();
        gameOverMenu.SetNFlipsLeft(statsMeta.MaxFlips);
        gameOverMenu.gameObject.SetActive(false);
        ResumeGame();

        stacks = new List <Stack> ();
        stacks.Add(gamestacks.Player);
        foreach (Stack stack in stacks)
        {
            stack.AddListener(this);
        }
    }