void HandleRolls()
        {
            if (!roll || usingItem)
            {
                return;
            }

            float rollVertical   = vertical;
            float rollHorizontal = horizontal;

            rollVertical   = (moveAmount > 0.3f) ? 1 : 0;
            rollHorizontal = 0;

            // if (!lockOn)
            // {
            //   rollVertical = (moveAmount > 0.3f) ? 1 : 0;
            //   rollHorizontal = 0;
            // }
            // else
            // {
            //   if (Mathf.Abs(rollVertical) < 0.3f)
            //     rollVertical = 0;
            //   if (Mathf.Abs(rollHorizontal) < 0.3f)
            //     rollHorizontal = 0;
            // }

            if (rollVertical != 0)
            {
                if (moveDirection == Vector3.zero)
                {
                    moveDirection = transform.forward;
                }

                Quaternion targetRotation = Quaternion.LookRotation(moveDirection);
                transform.rotation = targetRotation;
                animatorHook.InitForRoll();
                animatorHook.rootMotionMultiplier = rollSpeed;
            }
            else
            {
                animatorHook.rootMotionMultiplier = 1.3f;
            }

            animator.SetFloat("vertical", rollVertical);
            animator.SetFloat("horizontal", rollHorizontal);

            canMove  = false;
            inAction = true;
            animator.CrossFade("Rolls", 0.2f);
        }
        void HandleRolls()
        {
            if (!rollInput || usingItem)
            {
                return;
            }

            float v = vertical;
            float h = horizontal;

            v = (moveAmount > 0.3f) ? 1 : 0;
            h = 0;

            /*     if(lockOn == false)
             *   {
             *       v = (moveAmount > 0.3f)? 1 : 0;
             *       h = 0;
             *   }
             *   else
             *   {
             *       if (Mathf.Abs(v) < 0.3f)
             *           v = 0;
             *       if (Mathf.Abs(h) < 0.3f)
             *           h = 0;
             *   }*/

            if (v != 0)
            {
                if (moveDir == Vector3.zero)
                {
                    moveDir = transform.forward;
                }
                Quaternion targetRot = Quaternion.LookRotation(moveDir);
                transform.rotation = targetRot;
                a_hook.InitForRoll();
                a_hook.rm_multi = rollSpeed;
            }
            else
            {
                a_hook.rm_multi = 1.3f;
            }


            anim.SetFloat(StaticStrings.vertical, v);
            anim.SetFloat(StaticStrings.horizontal, h);

            canMove  = false;
            inAction = true;
            anim.CrossFade(StaticStrings.Rolls, 0.2f);
        }
Exemple #3
0
        public void HandleRolls()
        {
            if (!rollInput)
            {
                return;
            }

            float v = vertical;
            float h = horizontal;

            // Correct way, blending animations, animations MUST be good

            /*if (!lockOn)
             * {
             *  v = (moveAmount > 0.3f) ? 1 : 0;
             *  h = 0;
             * }
             * else
             * {
             *  if (Mathf.Abs(v) < 0.3f) v = 0;
             *  if (Mathf.Abs(h) < 0.3f) h = 0;
             * }*/
            // Hack if animations are shit
            if (v != 0)
            {
                //v = (moveAmount > 0.3f) ? 1 : 0;
                // h = 0;
                if (moveDir == Vector3.zero)
                {
                    moveDir = transform.forward;
                }
                Quaternion targetRot = Quaternion.LookRotation(moveDir);
                transform.rotation = targetRot;
                a_hook.InitForRoll();
                a_hook.rm_Multiplier = rollSpeed;
            }
            else
            {
                a_hook.rm_Multiplier = 1.3f;
            }



            anim.SetFloat("vertical", v);
            anim.SetFloat("horizontal", h);

            canMove  = false;
            inAction = true;
            anim.CrossFade("Rolls", 0.2f);
        }
        void HandleRolls()
        {
            if (!circulo || usingItem)
            {
                return;
            }
            float v = vertical;
            float h = horizontal;

            v = (moveAmount > 0.3f) ? 1 : 0;
            h = 0;

            /*if (!lockOn)
             * {
             *  v = (moveAmount>0.3f) ? 1 : 0;
             *  h = 0;
             * }
             * else
             * {
             *  if (Mathf.Abs(v) < 0.3f)
             *      v = 0;
             *  if (Mathf.Abs(h) < 0.3f)
             *      h = 0;
             * }*/

            if (v != 0)
            {
                if (moveDir == Vector3.zero)
                {
                    moveDir = transform.forward;
                }
                Quaternion targetRot = Quaternion.LookRotation(moveDir);
                transform.rotation = targetRot;
                a_hook.InitForRoll();
                a_hook.rootMotionMultiplier = rollSpeed;
            }
            else
            {
                a_hook.rootMotionMultiplier = 1.3f;
            }

            anim.SetFloat("Vertical", v);
            anim.SetFloat("Horizontal", h);

            canMove  = false;
            inAction = true;
            anim.CrossFade("Rolls", 0.2f);
        }
        //************Locomotions*****************

        void HandleRolls()
        {
            if (!rollInput || usingItem || characterStats._stamina < 10)
            {
                return;
            }
            // will roll instantly, no delay.
            float v = vertical;
            float h = horizontal;

            v = (moveAmount > 0.3f) ? 1 : 0;
            h = 0;

            // Direction.
            // rotate the target to the rolling direction to match the animation at the end
            //, thus when the animation is ended, the target is set to rotate to the matching direction.
            if (v != 0)
            {
                if (moveDir == Vector3.zero)
                {
                    moveDir = transform.forward;
                }

                transform.rotation = Quaternion.LookRotation(moveDir);

                a_hook.InitForRoll();
                a_hook.rm_multi = rollSpeed;
            }
            else
            {
                a_hook.rm_multi = 1.3f;
            }

            // setting input values.
            anim.SetFloat("vertical", v);
            anim.SetFloat("horizontal", h);

            //To run the inAction evaluation:
            canAttack = false;
            onEmpty   = false;
            canMove   = false;
            inAction  = true;
            anim.CrossFade("Rolls", 0.2f);
            isInvincible             = true;
            isBlocking               = false;
            characterStats._stamina -= 25f;
        }
Exemple #6
0
        void HangleRolls()
        {
            if (!rollInput || usingItem)
            {
                return;
            }
            float h = vertical;
            float v = horizontal;

            v = (moveAmount > 0.3f) ? 1 : 0;
            h = 0;

//			if (!lockOn) {
//				v = (moveAmount > 0.3f) ? 1 : 0;
//				h = 0;
//			} else {
//				if (Mathf.Abs (v) > 0.3f)
//					v = 0;
//				if (Mathf.Abs (h) < 0.3f)
//					h = 0;
//			}
            if (v != 0)
            {
                if (moveDir == Vector3.zero)
                {
                    moveDir = transform.forward;
                }
                Quaternion targetRot = Quaternion.LookRotation(moveDir);
                transform.rotation  = targetRot;
                a_hook.rm_muliplier = rollSpeed;
                a_hook.InitForRoll();
            }
            else
            {
                a_hook.rm_muliplier = 2.5f;
            }


            anim.SetFloat("vertical", v);
            anim.SetFloat("horizontal", h);

            canMove  = false;
            inAction = true;
            anim.CrossFade("Rolls", 0.2f);
        }