Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        BeforeUpdate();

        if (isFloating == false)
        {
            moveProc.UpdateByParent();

            jumpProc.UpdateByParent();
        }


        //处理既下落又滑落的情况。
        bool    hasFall  = false;
        bool    hasSlide = false;
        Vector3 posBegin;

        posBegin = transform.position;
        //下落
        if (fallProc.isActiveAndEnabled && isFloating == false)
        {
            fallProc.UpdateByParent();
            if (transform.position != posBegin)
            {
                hasFall = true;
            }
        }
        Vector3 posMid = transform.position;

        //滑落
        if (slideProc.isActiveAndEnabled)
        {
            slideProc.UpdateByParent();
            if (transform.position != posMid)
            {
                hasSlide = true;
            }
        }
        Vector3 posEnd = transform.position;

        if (hasFall && hasSlide && groundDct.IsOnIceground())
        {
            transform.position = Vector3.Lerp(posBegin, posEnd, 0.7f);
        }

        groundDct.UpdateByParent();
    }