Example #1
0
        public Vector2 Update()
        {
            // INIT
            if (!dashing && InputWrapper.GetDash() && canDash)
            {
                dashTime    = dashTimeMax;
                dashing     = true;
                canDash     = false;
                dashPostFix = false;

                if (super.isWall)                   // FIX
                {
                    dashRight = super.wallNormal < 0;
                }
                else
                {
                    dashRight = super.lookingRight;
                }
            }

            // DASH
            if (dashing)
            {
                realVel           = new Vector2(dashSpeed * (dashRight ? 1 : -1), 0);
                super.overrideVel = realVel;

                if (dashTime > 0.03f && super.isWall)
                {
                    dashing = false;
                }

                if (dashTime > 0)
                {
                    dashTime -= Time.fixedDeltaTime;
                }
                else
                {
                    dashing = false;
                }
            }

            // RESET ONCE
            if (!dashPostFix && !dashing)
            {
                dashPostFix         = true;
                super.overrideVel.x = 0;
                //super.pmove.ZeroDirection(!dashRight);
            }

            return(Vector2.zero);
        }