Exemple #1
0
    void Update()
    {
        //Z軸所得
        LongangleZ = Minutehand.transform.localEulerAngles.z;
        ShortanglZ = Shorthand.transform.localEulerAngles.z;
        //時計盤の色取得
        clockimage.GetComponent <Image>().color = new Color(clockColor_r, clockColor_g, clockColor_b, clockColor_a);

        //カウントダウン開始
        if (ClockStart == true)
        {
            //時間が進む
            timer += 1 * Time.deltaTime;

            //針を動かす
            if (timer >= 20)
            {
                timer = 0;
                hour--;
            }
            //分針
            Minutehand.transform.eulerAngles += new Vector3(0f, 0f, -1.0f) * Time.deltaTime * 18;
            //時針
            Shorthand.transform.eulerAngles += new Vector3(0f, 0f, -1.5f) * Time.deltaTime * 1;

            //制限時間終了時
            if (hour == 0 && timer == 0)
            {
                soundsManager.Alarm();
            }

            //点滅時の色変更
            //1秒ごとの判別式
            colorChange = (int)timer % 2;

            //残り時間が1時間を切ったら点滅開始
            if (hour <= 1)
            {
                if (colorChange == 0)
                {
                    clockColor_r = 1.0f;
                    clockColor_g = 0.19f;
                    clockColor_b = 0f;
                    clockColor_a = 1f;
                }
                else
                {
                    clockColor_r = 1f;
                    clockColor_g = 1f;
                    clockColor_b = 1f;
                    clockColor_a = 1f;
                }
            }
        }
        else if (!ClockStart)
        {
            soundsManager.GamePlayBGM();
            ClockStart = true;
        }
    }