예제 #1
0
    // Initializes "Taquin" Game
    // From a resolvable instance, perform transformations to initalize the game
    private void initGame()
    {
        List <Button> allButtons = new List <Button>();

        foreach (Button btn in childrens)
        {
            if (btn.name != "16")
            {
                allButtons.Add(btn);
            }
        }

        int numberOfTransformations = UnityEngine.Random.Range(30, 101);

        for (int i = 1; i <= numberOfTransformations; i++)
        {
            foreach (Button btn in allButtons)
            {
                BtnController btnController = btn.GetComponent <BtnController>();
                swapWithEmptyIfPossible(btn);
            }
        }
        foreach (Button btn in allButtons)
        {
            BtnController btnController = btn.GetComponent <BtnController>();
            btnController.InitializingGame = false;
        }
    }
예제 #2
0
    private void Awake()
    {
        /*GameObject[] objs = GameObject.FindGameObjectsWithTag("GameController");
         *
         * if (objs.Length > 1)
         * {
         *  Destroy(this.gameObject);
         * }
         *
         * DontDestroyOnLoad(this.gameObject);*/


        _animationController = GetComponent <AnimationController>();
        _uiController        = GetComponent <UiController>();
        _btnController       = GetComponent <BtnController>();
        _inputController     = GetComponent <InputController>();
        _audioController     = GetComponent <AudioController>();
        _levelController     = LevelController.single;
    }