示例#1
0
    private void Awake()
    {
        if (!PlayerPrefs.HasKey("VIBRATION"))
        {
            PlayerPrefs.SetInt("VIBRATION", 1);
            VibrationButton.GetComponent <Image>().sprite = on;
        }
        else
        {
            if (PlayerPrefs.GetInt("VIBRATION") == 1)
            {
                VibrationButton.GetComponent <Image>().sprite = on;
            }
            else
            {
                VibrationButton.GetComponent <Image>().sprite = off;
            }
        }
        currentLevel   = PlayerPrefs.GetInt("LevelId");
        LevelText.text = "Level " + currentLevel;
        if (PlayerPrefs.GetInt("FromMenu") == 1)
        {
            PlayerPrefs.SetInt("FromMenu", 0);
        }
        else
        {
            isGameStarted = true;
            switch (currentLevel)
            {
            case 2:
                Tutorial2.SetActive(true);
                break;

            case 3:
                Tutorial3.SetActive(true);
                break;

            default:
                break;
            }
            TapToStartButton.gameObject.SetActive(false);
        }
    }
示例#2
0
    public void TapToStartButtonClick()
    {
        isGameStarted = true;
        switch (currentLevel)
        {
        case 1:
            Tutorial1.SetActive(true);
            break;

        case 2:
            Tutorial2.SetActive(true);
            break;

        case 3:
            Tutorial3.SetActive(true);
            break;

        default:
            break;
        }
    }
示例#3
0
    private void Update()
    {
        if (isGameEnd || !isGameStarted)
        {
            return;
        }
        if (cubeManager.CubesWillBeDestroyed.Count == 0)
        {
            isGameEnd = true;
            cubeManager.ColorAllCubes();
            switch (currentLevel)
            {
            case 1:
                Tutorial1.SetActive(false);
                break;

            case 2:
                Tutorial2.SetActive(false);
                break;

            case 3:
                Tutorial3.SetActive(false);
                break;

            default:
                break;
            }
            StartCoroutine(WaitAndGameWin());
            Debug.Log("<color=green/>Game Win</color>");
        }
        else if (live <= 0)
        {
            isGameEnd = true;
            switch (currentLevel)
            {
            case 1:
                Tutorial1.SetActive(false);
                break;

            case 2:
                Tutorial2.SetActive(false);
                break;

            case 3:
                Tutorial3.SetActive(false);
                break;

            default:
                break;
            }
            StartCoroutine(WaitAndGameLose());
        }
        if (Input.GetMouseButton(0))
        {
            if (ContinueTutorial.activeSelf)
            {
                counter = 0;
                ContinueTutorial.SetActive(false);
            }
        }
        else
        {
            counter += Time.deltaTime;
            if (counter >= 5f)
            {
                if (!ContinueTutorial.activeSelf)
                {
                    ContinueTutorial.SetActive(true);
                }
            }
        }
    }