Example #1
0
    public void NewGame()
    {
        hubValue.score = 0;
        hubValue.timer = 0;
        for (int i = 0; i < boardValue.GetBoard().Length; i++)
        {
            boardValue.SetValue(i, 0);
        }
        Scene scene = SceneManager.GetActiveScene();

        SceneManager.LoadScene(scene.name);
        if (panelGameOver.activeSelf)
        {
            panelGameOver.SetActive(false);
            isGameOver = false;
        }
    }
Example #2
0
    void UpdateBall()
    {
        for (int i = 0; i < boardValue.GetBoard().Length; i++)
        {
            Ball ball = transform.GetChild(i).GetComponent <Ball>();

            if (boardValue.GetBoard()[i] > 0)
            {
                ball.gameObject.SetActive(true);
                ball.SetType(boardValue.GetValue(i) - 1);
                ball.gameObject.transform.localScale = Vector3.one;
            }
            else if (boardValue.GetBoard()[i] < 0)
            {
                ball.SetType(Mathf.Abs(boardValue.GetValue(i)) - 1);
                ball.gameObject.transform.localScale = Vector3.one / 2;
                ball.gameObject.SetActive(true);
            }
            else if (boardValue.GetBoard()[i] == 0)
            {
                ball.gameObject.SetActive(false);
            }
        }
    }