Ejemplo n.º 1
0
    private void FixedUpdate()
    {
        if (!isGameSet)
        {
            if (isCharacterCreate)
            {
                createCount += Time.fixedDeltaTime;

                if (createCount >= createTime)
                {
                    createCharacter.SetCharacter();
                    gameObject.GetComponent <ObjectActiveController>().OnGaugeActive();

                    createCount       = 0;
                    isCharacterCreate = false;
                }
            }
        }
        else
        {
            if (isCharacterCreate)
            {
                if (lifeController.Life <= 0)
                {
                    createCount += Time.fixedDeltaTime;

                    if (createCount >= createTime)
                    {
                        Debug.Log("gameover");
                        isFailure         = true;
                        createCount       = 0;
                        isCharacterCreate = false;
                        curtainCanvas.SetActive(true);
                    }
                }
                else
                {
                    createCount += Time.fixedDeltaTime;

                    if (createCount >= createTime)
                    {
                        Debug.Log("gameclear");
                        isSuccess         = true;
                        createCount       = 0;
                        isCharacterCreate = false;
                        curtainCanvas.SetActive(true);
                    }
                }
            }
        }

        if (isSuccess || isFailure)
        {
            sceneChangeCount += Time.fixedDeltaTime;

            if (sceneChangeCount >= sceneChangeTime)
            {
                if (isSuccess)
                {
                    SceneManager.LoadScene(Constant.Scene.ResultSuccess);
                }
                if (isFailure)
                {
                    SceneManager.LoadScene(Constant.Scene.ResultFailure);
                }
            }
        }
    }