//被摧毀時
    public void OnDestroy()
    {
        try
        {
            TypingCellControl parent = transform.parent.parent.GetComponent <TypingCellControl>();
            if (parent != null)
            {
                parent.StartCoroutine(parent.ProduceGapTime(FreLevel, parent.GapTime));
            }
        }
        catch (System.Exception ex) {
            Debug.Log("<color=gray>不重要:</color>" + ex);
        }

        if (GM.playerPreference.IsVibrate)
        {
            //Handheld.Vibrate();
            Vibration.Vibrate(15);
        }


        //產生特效:----------------
        GameObject scoreTxt = Instantiate(TimingText_Prefab, gameObject.transform.position, Quaternion.identity);

        scoreTxt.transform.GetChild(0).GetComponent <TMPro.TextMeshProUGUI>().text = Score;

        //紀錄

        switch (Score)
        {
        case "Perfect":
            ComboControl.Weighting[0]++;

            break;

        case "Good":
            ComboControl.Weighting[1]++;
            break;

        case "Bad":
            ComboControl.Weighting[2]++;
            break;
        }
        ComboControl.TotalScore = ComboControl.Weighting[0] * 5 + ComboControl.Weighting[1] * 2 + ComboControl.Weighting[2] - ComboControl.MissCombo * 3;

        Destroy(scoreTxt, 0.5f);
        //-------------------------
    }
Пример #2
0
    //設定難度:
    public void SetDifficultLevel()
    {
        Debug.Log("難度設定OK");
        TypingCellControl _obj = GameObject.FindObjectOfType <TypingCellControl>();

        switch (GM.Difficult)
        {
        //Easy:
        case 0:
            _obj.BobbleLifetime = 2.5f;
            _obj.FreDeviation   = 0.05f;
            _obj.GapTime        = 1f;
            break;

        //Normal:
        case 1:
            _obj.BobbleLifetime = 2f;
            _obj.FreDeviation   = 0.15f;
            _obj.GapTime        = 0.25f;
            break;

        //Hard:
        case 2:
            _obj.BobbleLifetime = 1.5f;
            _obj.FreDeviation   = 0.35f;
            _obj.GapTime        = 0.15f;
            break;

        //Extreme:
        case 3:
            _obj.BobbleLifetime = 1.25f;
            _obj.FreDeviation   = 0.85f;
            _obj.GapTime        = 0.09f;
            break;
        }

        //4- (提示時間)*加速比例
        MuteSoundPlayDelay = 4 - 0.5f * (_obj.BobbleLifetime / BubbleOriginAnimaTime);
    }