Exemplo n.º 1
0
 void Update()
 {
     if (GameObject.Find("Canvas").GetComponent <Buttonlighter> ().getPlayerScore() == scoreThreshold)
     {
         GetComponent <AudioSource> ().Stop();
         //set parameters to mark game is done
         Calarm.setGameDoneCS(true);
         //load the initial scene
         SceneManager.LoadScene("AlarmClock_scene");
     }
 }
Exemplo n.º 2
0
    void Start()
    {
        Calarm.askForUserPermitCS();
        Application.runInBackground = true;
        timeNow = DateTime.Now;
        audio1  = GetComponent <AudioSource>();

        Button b = b1.GetComponent <Button>();

        b.onClick.AddListener(() => actionOnClick(b));

        Button c = b2.GetComponent <Button>();

        c.onClick.AddListener(() => actionOnClick2(c));

        selected = false;
    }
Exemplo n.º 3
0
    void actionOnClick(Button b)
    {
        Debug.Log("Success click");

        //get the hour and int in the dropdown selection
        int hour_int   = 0;
        int minute_int = 0;

        hour_string   = hour1.GetComponent <Dropdown>().captionText.text;
        minute_string = minute1.GetComponent <Dropdown>().captionText.text;

        Int32.TryParse(hour_string, out hour_int);
        Int32.TryParse(minute_string, out minute_int);

        //if not selected, register for the clock, if selected, unregister it
        if (!selected)
        {
            //move to selected position
            b.GetComponent <RectTransform> ().localPosition = new Vector3(237f, 343.3f, 0f);
            selected = true;

            //register alarm in unity "settings" script
            GameObject.Find("Main Camera").GetComponent <settings>().setHour(hour_int);
            GameObject.Find("Main Camera").GetComponent <settings>().setMinute(minute_int);

            //register for ios alarm
            Calarm.registerForAlarmCS(hour_int, minute_int);
        }
        else
        {
            //move to unselected position
            b.GetComponent <RectTransform> ().localPosition = new Vector3(182f, 343.3f, 0f);
            selected = false;

            //unregister for ios alarm
            Calarm.unregisterForAlarmCS();
        }
    }