예제 #1
0
    void HandleDodges()
    {
        if (!dodgeInput)
        {
            return;
        }

        float v = vertical;
        float h = horizontal;

        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.rootMotionMultiplier = rollSpeed;
        }
        else
        {
            a_hook.rootMotionMultiplier = 1.3f;
        }


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

        canMove   = false;
        attacking = true;
        _anim.CrossFade("Dodges", 0.2f);
    }
예제 #2
0
    void HandleRolls()
    {
        if (!rollInput || 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(StaticStrings.vertical, v);
        anim.SetFloat(StaticStrings.horizontal, h);

        onEmpty   = false;
        canAttack = false;
        canMove   = false;
        inAction  = true;
        anim.CrossFade(StaticStrings.Rolls, 0.2f);
    }
예제 #3
0
    void HandleRoll()
    {
        if (!l2)
        {
            return;
        }
        float v = (moveAmount > 0.3)?1 :0;
        float h = horizontal;

        a_hook.rm_multi = BaseData.Instance.rollSpeed;
        a_hook.InitForRoll();
        if (v == 0)
        {
            v = 1;
        }
        anim.SetFloat("horizontal", h);
        anim.SetFloat("vertical", v);

        //model.SetActive(false);
        //model.transform.localScale=new Vector3(0.2f,0.2f,0.2f);
        var effect = Instantiate(effectPrefab, transform.position, Quaternion.identity);

        //effect.transform.position = model.transform.position;
        Destroy(effect, effect.transform.GetChild(0).GetComponent <ParticleSystem>().main.duration);
        StartCoroutine(Camera.main.GetComponent <CameraShaker>().CameraShakeOneShot(0.5f, 0.1f, 2f));
        perfectDodge        = true;
        canMove             = false;
        inAction            = true;
        invincible          = true;
        run                 = true;
        rotateSpeed         = 4;
        _actionDelayMaxTime = 0.3f;
        dodgeCount         += 1;
        dodgeCountText.text = "Dodge:" + dodgeCount.ToString();
        anim.CrossFade("Rolls", 0.2f);
    }
예제 #4
0
    void HandleRolls()
    {
        if (!rollInput || isUsingItem)
        {
            return;
        }

        float v = vertical;
        float h = horizontal;

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

        /////////////////////////////////////////////////////////
        //WHEN YOU HAVE BETTER ROLLING ANIMATIONS USE THIS PART//
        /////////////////////////////////////////////////////////

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

        //So that you can still jump backwards
        if (v != 0)
        {
            if (moveDirection == Vector3.zero)
            {
                moveDirection = transform.forward;
            }

            Quaternion targetRot = Quaternion.LookRotation(moveDirection);
            transform.rotation = targetRot;
            animHook.InitForRoll();
            animHook.rootMotionMultiplier = rollSpeed;
        }
        //If stepping back
        else
        {
            animHook.rootMotionMultiplier = 1.3f;
        }

        animator.SetFloat(StaticStrings.Input_Vertical, v);
        animator.SetFloat(StaticStrings.Input_Horizontal, h);

        PlayAnimation(StaticStrings.animState_Rolls);

        //You cant block while rolling
        isBlocking = false;
    }