Exemplo n.º 1
0
 public void UpdateMusicVolume()
 {
     if (bgSound.GetComponent <AudioSource>() != null)
     {
         bgSound.volume = volumeSlider.value;
     }
     SavenLoad.setting.volumeMusic = volumeSlider.value;
     SavenLoad.Save();
 }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        SavenLoad.Load();
        GameObject.Find("ButtonSound").GetComponent <AudioSource> ().volume = SavenLoad.setting.volume;
        GameObject.Find("UnlockSound").GetComponent <AudioSource> ().volume = SavenLoad.setting.volume;
        GameObject.Find("BgSound").GetComponent <AudioSource> ().volume     = SavenLoad.setting.volumeMusic;

        ThemeCollection.getThemes();
        Invoke("ProcessToMain", 0.75f);
    }
Exemplo n.º 3
0
    IEnumerator LoadCoroutine()                                              //씬이 로드될때까지 대기하기위해 코루틴 사용
    {
        AsyncOperation operation = SceneManager.LoadSceneAsync("GameScene"); //로드를하기위한 플레이어가 다음 씬에 있으니 우선 씬 이동

        while (!operation.isDone)                                            //씬 로딩이 끝날때까지
        {
            yield return(null);                                              //대기
        }
        theSave = FindObjectOfType <SavenLoad>();
        theSave.LoadData();                         //씬 이동 후에도 싱글턴화 했기 때문에 객체가 남아있어서 실행 가능
        this.gameObject.SetActive(false);
    }
Exemplo n.º 4
0
 // Update is called once per frame
 public void UpdateVolume()
 {
     if (buttonSound.GetComponent <AudioSource>() != null)
     {
         buttonSound.volume = volumeSlider.value;
     }
     if (unlockSound.GetComponent <AudioSource>() != null)
     {
         unlockSound.volume = volumeSlider.value;
     }
     SavenLoad.setting.volume = volumeSlider.value;
     SavenLoad.Save();
 }
Exemplo n.º 5
0
    public void checkAns(string playerAns)
    {
        bool isCorrect = FormatAnswer(playerAns).Equals(answer) || FormatAnswer(playerAns).Equals(reverse(answer));

        if (isCorrect)
        {
            hardness = UnityEngine.Random.Range(2 + (score / 10 > 4?4:score / 10), 5 + (score / 3 > 5?5:score / 3));
            newGame(hardness);

            unlockSound.Play();
            switch (SavenLoad.setting.Mission.currentMission)
            {
            case Mission.UNLOCK_X_PATTERNS_TOTAL:
            case Mission.UNLOCK_X_PATTERNS_IN_1_GAME:
                SavenLoad.setting.Mission.current += 1;
                SavenLoad.Save();
                break;

            case Mission.UNLOCK_X_PATTERNS_IN_UNDER:
                if (maxTime - countdown < 3)
                {
                    SavenLoad.setting.Mission.current += 1;
                }
                SavenLoad.Save();
                break;
            }
            if (SavenLoad.setting.Mission.isCompleted() && !completedMissionMessage)
            {
                GameObject.Find("lblFinishedMission").GetComponent <Animator>().SetInteger("Animation", 1);
                completedMissionMessage = true;
            }
            score       += 1;
            scoreTb.text = score + "";

            /*if (score > SavenLoad.setting.highscore) {
             *      SavenLoad.setting.highscore = score;
             *      SavenLoad.Save();
             * }*/
        }
        else
        {
            countdown = countdown - timeReducedWhenWrong;
            lineColor = new Color(1, 1, 1, 0.7f);
            if (SavenLoad.setting.vibrate)
            {
                Handheld.Vibrate();
            }
        }
    }
Exemplo n.º 6
0
 public void LoadScene(int level)
 {
     if (level == 2 && SavenLoad.setting.firstTime == 2)
     {
         SavenLoad.setting.firstTime = 1;
         GameObject.Find("SceneFader").GetComponent <SceneFadeInOut> ().LoadScene(4);
     }
     else if (level == 1 && SavenLoad.setting.firstTime == 1)
     {
         SavenLoad.setting.firstTime = 0;
         SavenLoad.Save();
         GameObject.Find("SceneFader").GetComponent <SceneFadeInOut> ().LoadScene(2);
     }
     else
     {
         GameObject.Find("SceneFader").GetComponent <SceneFadeInOut> ().LoadScene(level);
     }
     //Application.LoadLevel (level);
 }
Exemplo n.º 7
0
    public void UpdateSelected()
    {
        //GameObject.Find ("btnSelectText").GetComponent<Text> ().text = ((RectTransform)transform).anchoredPosition.ToString ();
        Vector2 cur = ((RectTransform)transform).anchoredPosition;

        selectedTheme = Mathf.RoundToInt(-(cur.y + 1 * LoadThemeList.basedistance) / LoadThemeList.basedistance);
        //GameObject.Find ("abcdef").GetComponent<Text> ().text = selectedTheme + "";
        if (selectedTheme <= SavenLoad.setting.point / 9)
        {
            GameObject.Find("SelectedTheme").GetComponent <RectTransform>().anchoredPosition = cur;
            SavenLoad.setting.activedTheme = selectedTheme;
            SavenLoad.Save();
            GameObject.Find("Canvas").GetComponent <LoadTheme> ().Start();
        }

        /*	GameObject.Find ("SelectedTheme").GetComponent<RectTransform>().anchoredPosition = cur;
         *      SavenLoad.setting.activedTheme = selectedTheme;
         *      SavenLoad.Save ();
         *      GameObject.Find ("Canvas").GetComponent<LoadTheme> ().Start ();
         */
    }
Exemplo n.º 8
0
    // Use this for initialization
    public void Start()
    {
        if (SavenLoad.setting.Mission.isCompleted())
        {
            //Call change mission
            Text txtMission = GameObject.Find("txtMission").GetComponent <Text>();
            txtMission.text  = "" + SavenLoad.setting.Mission.completedMission();
            txtMission.color = new Color(59, 174, 255);
        }
        else
        {
            GameObject.Find("txtMission").GetComponent <Text>().text = "" + SavenLoad.setting.Mission.getMessage();
        }
        if (SavenLoad.setting.point % 9 == 0)
        {
            LoadThemeList.UnlockTheme(SavenLoad.setting.point / 9);
        }
        int missionNo = SavenLoad.setting.point + 1;

        GameObject.Find("lblMission").GetComponent <Text> ().text = "MISSION " + (missionNo > 270?"":(missionNo + ""));
        SavenLoad.Save();
    }
Exemplo n.º 9
0
    void GameOver()
    {
        gameover = true;
        StopMusic();
        SavenLoad.sessionGamePlayed += 1;
        if (SavenLoad.sessionGamePlayed % 4 == 0 && AdMob.interstitial != null && AdMob.interstitial.IsLoaded())
        {
            AdMob.interstitial.Show();
        }
        if (SavenLoad.setting.Mission.currentMission == Mission.PLAY_X_GAME)
        {
            SavenLoad.setting.Mission.current += 1;
        }
        if (SavenLoad.setting.vibrate)
        {
            Handheld.Vibrate();
        }
        Text txtEndScore = GameObject.Find("txtEndScore").GetComponent <Text> ();
        Text txtEndBest  = GameObject.Find("txtEndBest").GetComponent <Text> ();

        txtEndScore.text = score + "";
        if (score > SavenLoad.setting.highscore)
        {
            SavenLoad.setting.highscore = score;
            SavenLoad.Save();
        }
        txtEndBest.text = SavenLoad.setting.highscore + "";

        /*if(Int32.Parse(txtBest.text)<score){
         *      txtEndScore.color = new Color(325,210,255);
         * }*/
        if (Social.localUser.authenticated)
        {
            Social.ReportScore(score, "CgkI2-rT87cREAIQAA", (bool success) =>
            {
                // handle success or failure
            });
            PlayGamesPlatform.Instance.IncrementAchievement("CgkI2-rT87cREAIQBg", 1, (bool success) => { });
            PlayGamesPlatform.Instance.IncrementAchievement("CgkI2-rT87cREAIQBw", 1, (bool success) => { });
            PlayGamesPlatform.Instance.IncrementAchievement("CgkI2-rT87cREAIQCA", 1, (bool success) => { });
        }

        if (SavenLoad.setting.Mission.isCompleted())
        {
            //Call change mission
            Text txtMission = GameObject.Find("txtMission").GetComponent <Text>();
            txtMission.color = new Color(59, 174, 255);
            txtMission.text  = "" + SavenLoad.setting.Mission.completedMission();
        }
        else
        {
            GameObject.Find("txtMission").GetComponent <Text>().text = "" + SavenLoad.setting.Mission.getMessage();
        }
        int missionNo = SavenLoad.setting.point + 1;

        GameObject.Find("lblMission").GetComponent <Text> ().text = "MISSION " + (missionNo > 270?"":(missionNo + ""));

        gameOverScene.GetComponent <Canvas> ().planeDistance          = 2;
        gameOverScene.GetComponent <GraphicRaycaster> ().enabled      = true;
        gameObject.GetComponentInParent <GraphicRaycaster> ().enabled = false;
        gameOverScene.GetComponentInChildren <Animator> ().SetBool("GameOver", true);
        //GameObject.Find ("GamePlay").SetActive (false);
    }
Exemplo n.º 10
0
 public void UpdateVibrate()
 {
     SavenLoad.setting.vibrate = vibrateToggle.isOn;
     SavenLoad.Save();
 }