Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        seconds += Time.deltaTime;

        //hp = maxHP - (100 / 60) * seconds * 2;
        // 値が変わった時だけHP減らす
        if ((int)seconds != (int)oldSeconds)
        {
            hp        -= 2.5f;
            oldSeconds = seconds;
        }

        //if (0.0f < hp)
        {
            hp_ratio = hp / maxHP;

            image_HPgauge.fillAmount = hp_ratio;
            color_h = Mathf.Lerp(0f, 0.4f, hp_ratio);

            image_HPgauge.color = HSLtoRGB(color_h, color_s, color_l);
        }

        // HP0、ゲームオーバー
        if (0.0f >= hp && !bFinish)
        {
            // 繰り返しここが実行されないように先にセットしておく
            bFinish = true;

            script = GameScript.GetComponent <ChangeCamera>();
            script.ChangeEndingCamera();
            scriptTimer = Timer.GetComponent <Timer>();
            scriptTimer.FinishTimer();

            Button.SetActive(false);

            //int nSelCharactor = SettingManager.LoadSelectCharactor();
            //ChangeCharactor ChangeChar = m_Charactor.GetComponent<ChangeCharactor>();
            //GameObject Charactor = ChangeChar.GetCharactor(nSelCharactor);

            MoveCharactor scriptMoveChar = m_Charactor.GetComponent <MoveCharactor>();
            scriptMoveChar.FinishGame();

            StartCoroutine("DispResult");
        }
    }