コード例 #1
0
 public void CreateWord(string text, float duration)
 {
     //print(text);
     ChangeFont();
     text_Voice.text = PinYin.GetShowText(text);
     MoveWord(rightPosX, leftPosX, duration);
 }
コード例 #2
0
    void _SetState(State state)
    {
        curState = state;
        ChangeFont();
        DOTween.Kill(tran_base);
        DOTween.Kill(text_word.transform);
        DOTween.Kill(sp_base.transform);

        switch (state)
        {
        case State.Default:
            text_word.text  = PinYin.GetShowText(first_word);
            text_word.color = Color.white;

            //text_word.Rebuild();
            text_word.transform.localScale       = Vector3.one;
            text_word.transform.localPosition    = Vector3.zero;
            sp_textField.transform.localScale    = Vector3.one;
            sp_textField.transform.localPosition = Vector3.zero;
            obj_wrongDisplay.SetActive(false);
            sp_base.sprite = sp_Default;
            sp_base.transform.localScale         = Vector3.one;
            sp_textField.transform.localPosition = Vector3.zero;
            tran_base.localScale    = Vector3.one;
            tran_base.localPosition = Vector3.zero;
            //do_highLight.gameObject.SetActive(false);

            foreach (var item in comp_WrongEnables)
            {
                item.enabled = false;
            }
            foreach (var item in sp_RightColors)
            {
                item.color = Color.white;
            }
            foreach (var item in sp_WrongColors)
            {
                item.color = Color.white;
            }
            break;

        case State.Perfect:
            // Effects
            //EffectManager.Play("TapStar", transform.position, ComboRate);
            if (CorePlayManager.Combo > 0 && (CorePlayManager.Combo % EffectSettings.Instance.comboInterval) == 0)
            {
                PlayComboTenEffect();
            }
            else
            {
                EffectManager.Play("LightningExplosion1", transform.position, ComboRate);
            }


            AudioController.Play("Tap");
            text_word.color = Color.yellow;
            //text_word.Rebuild();
            text_word.text = PinYin.GetShowText(second_word);
            text_word.transform.localScale = Vector3.one;
            text_word.transform.DOScale(2f, RightAnimDelay).SetEase(Ease.OutQuart);

            sp_textField.transform.DOScale(1.5f, RightAnimDelay).SetEase(Ease.OutQuart);
            sp_textField.transform.DOLocalMoveY(.3f, RightAnimDelay).SetEase(Ease.OutQuart);
            sp_textField.transform.DOPunchRotation(new Vector3(0, 0, -15), RightAnimDelay);

            obj_wrongDisplay.SetActive(false);
            sp_base.sprite = sp_Right;
            sp_base.transform.localScale = Vector3.one;
            sp_base.transform.DOScale(1.2f, 0.5f).SetEase(Ease.OutSine);

            foreach (var item in comp_WrongEnables)
            {
                item.enabled = false;
            }
            foreach (var item in sp_RightColors)
            {
                item.color = colorRight;
            }
            foreach (var item in sp_WrongColors)
            {
                item.color = Color.white;
            }
            break;

        case State.Right:
            // Effects
            //EffectManager.Play("TapStar", transform.position, ComboRate);
            if (CorePlayManager.Combo > 0 && (CorePlayManager.Combo % EffectSettings.Instance.comboInterval) == 0)
            {
                PlayComboTenEffect();
            }

            text_word.text = PinYin.GetShowText(second_word);
            text_word.transform.localScale = Vector3.one;
            text_word.transform.DOScale(1.3f, RightAnimDelay);
            sp_textField.transform.DOScale(1.2f, RightAnimDelay).SetEase(Ease.OutQuart);
            sp_textField.transform.DOLocalMoveY(.3f, RightAnimDelay).SetEase(Ease.OutQuart);
            //sp_textField.transform.localPosition = new Vector3(0, 1.2f, 0);
            obj_wrongDisplay.SetActive(false);
            //sp_base.sprite = sp_Right;
            sp_base.transform.localScale = Vector3.one;
            sp_base.transform.DOScale(1.1f, 0.5f).SetEase(Ease.OutQuart);

            foreach (var item in comp_WrongEnables)
            {
                item.enabled = false;
            }
            foreach (var item in sp_RightColors)
            {
                item.color = colorRight;
            }
            foreach (var item in sp_WrongColors)
            {
                item.color = Color.white;
            }
            break;

        case State.Wrong:
            AudioController.Play("TapWrong");
            text_word.text = " ";
            sp_base.sprite = sp_Default;
            obj_wrongDisplay.SetActive(true);
            tran_base.DOShakePosition(1, new Vector3(.3f, .3f, 0), 15);

            foreach (var item in comp_WrongEnables)
            {
                item.enabled = true;
            }
            foreach (var item in sp_RightColors)
            {
                item.color = Color.white;
            }
            foreach (var item in sp_WrongColors)
            {
                item.color = colorWrong;
            }
            break;
        }
    }