コード例 #1
0
ファイル: ChangeCola.cs プロジェクト: tomo97hs/TheCola
    // Update is called once per frame
    void Update()
    {
        colCheck = collisionCheck.GetColChecked();          // 衝突検知

        if (colCheck)
        {
            if (fallChacked)
            {
                cola.SetActive(false);
                if (oneTime)
                {
                    sound01.PlayOneShot(sound01.clip);
                }

                if (--colaLife == 0)
                {
                    oneTime = false;
                    fallCola.transform.position = cola.transform.position;
                    fallCola.SetActive(true);
                    gameOverText.enabled = true;
                    //cola.SetActive (false);
                    gameOverChecked = true;
                }

                /* game overじゃなかったら */
                if (gameOverChecked == false)
                {
                    /* fallColaをCola Canの0.5上の位置に配置 */
                    pos    = cola.transform.position;
                    pos.y += 0.5f;
                    fallCola.transform.position = pos;
                    fallCola.SetActive(true);

                    StartCoroutine("sleep");
                    fallChacked = false;
                    colCheck    = false;
                }
            }
        }
        else
        {
            fallChacked = true;
            fallCola.SetActive(false);
        }
    }