示例#1
0
//    private IEnumerator CandyCoroutine()
//    {
//        var t = 1f;
//        BattleState = BattleState.Candy;
//        Utils.Animate(1f, 0.5f, 0.3f, v => CameraScript.Instance.SetScreenDarkness(v),
//            null, true);
//        Utils.Animate(Rt.anchoredPosition, new Vector2(0f, _offScreen / 2), 0.3f, v => Rt.anchoredPosition = v,
//            null, true);
//        yield return new WaitForSeconds(1f);
//        CandyUseText.text = "x" + _candyUse;
//        CandyUseText.gameObject.SetActive(true);
//        CandyUseText.fontSize = 45;
//        while (t > 0)
//        {
//            t -= Time.deltaTime / 2;
//            CandyBar.sizeDelta = new Vector2(300f * t, CandyBar.rect.height);
//            if (TapDown() && PlayerState.CandiesCount - _candyUse >= 0)
//            {
//                SetScale(Size1 * 1.5f, SubScale1);
//                SetScale(Size2 * 1.5f, SubScale2);
//                t = 1f;
//                PlayerState.CandiesCount -= _candyUse;
//                _candyUse *= 2;
//                CandyUseText.text = "x" + _candyUse;
//                if (CandyUseText.fontSize < 100)
//                {
//                    CandyUseText.fontSize += 10;
//                }
//                if (Size1 > 0.44f)
//                {
//                    SetScale(0.45f, SubScale1);
//                    SetScale(0.45f / 6, SubScale2);
//                    t = 0f;
//                }
//            }
//            yield return null;
//        }
//        yield return new WaitForSeconds(0.4f);
//        CandyBar.sizeDelta = new Vector2(0f, CandyBar.rect.height);
//        Hide();
//        BattleState = BattleState.Hidden;
//        CandyUseText.gameObject.SetActive(false);
//    }

    public void Run(bool noAnim = false)
    {
        BattleState = BattleState.PreStart;
        Utils.InvokeDelayed(() =>
        {
            BattleState = BattleState.Started;
            _pc.StartMoving();
        }, 0.7f);
        if (noAnim)
        {
            return;
        }
        Utils.Animate(1f, 0.5f, 0.3f, v => SpriteDarken.DarkValue = v,
                      null, true);
        Utils.Animate(Rt.anchoredPosition, new Vector2(0f, _onScreen), 0.3f, v => Rt.anchoredPosition = v,
                      null, true);
    }