Exemple #1
0
 public void UpdateMusicVolume()
 {
     if (bgSound.GetComponent <AudioSource>() != null)
     {
         bgSound.volume = volumeSlider.value;
     }
     SavenLoad.setting.volumeMusic = volumeSlider.value;
     SavenLoad.Save();
 }
Exemple #2
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();
 }
Exemple #3
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();
            }
        }
    }
Exemple #4
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);
 }
Exemple #5
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 ();
         */
    }
    // 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();
    }
Exemple #7
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);
    }
Exemple #8
0
 public void UpdateVibrate()
 {
     SavenLoad.setting.vibrate = vibrateToggle.isOn;
     SavenLoad.Save();
 }