//update distance score
    IEnumerator UpdatePerDistance()
    {
        bool paa = false;

        while (true)
        {
            if (PatternSystem.instance != null && PatternSystem.instance.loadingComplete)
            {
                paa = GameAttribute.Instance.pause || GameAttribute.Instance.passed;
                if (!paa && GameAttribute.Instance.isPlaying == true && GameAttribute.Instance.life > 0)
                {
                    if (Controller.Instance && Controller.Instance.transform.position.z > 0)
                    {
                        if (GameAttribute.Instance.time > 0)
                        {
                            GameAttribute.Instance.time -= Time.deltaTime;
                        }
                        else
                        {
                            GameAttribute.Instance.time = 0;
                        }
                        GameAttribute.Instance.Distance = player.transform.position.z;
                        if (GameAttribute.Instance.getRemainDistance() <= 0)
                        {
                            yield return(StartCoroutine(PassedGame()));
                        }
                        else if (GameAttribute.Instance.getRemainDistance() <= WalkDist + 100)
                        {
                            changeFloor();
                        }
                        else if (GameAttribute.Instance.Distance >= 0 && GameAttribute.Instance.Distance < 100)
                        {
                            SettingMaterial.needChange();
                            SettingMaterial.ChangeX(3000);
                        }
                        else if (GameAttribute.Instance.Distance >= 200 && GameAttribute.Instance.Distance < 500)
                        {
                            SettingMaterial.needChange();
                            SettingMaterial.ChangeX(0);
                        }
                        else if (GameAttribute.Instance.Distance >= 500 && GameAttribute.Instance.Distance < 1000)
                        {
                            SettingMaterial.needChange();
                            SettingMaterial.ChangeX(-3000);
                        }
                        if (GameAttribute.Instance.time <= 0)
                        {
                            yield return(StartCoroutine(FailedGame()));
                        }
                        if (GameAttribute.Instance.time <= 10 && GameAttribute.Instance.time > 0)
                        {
                            StartCoroutine(alarmTime());
                        }
                    }
                }
            }
            yield return(0);
        }
    }
 void Start()
 {
     Instance = this;
 }