Esempio n. 1
0
    void Close()
    {
        destination = Nav.GetCorners();

        if (d < MeleeDistance)
        {
            if (Mathf.Abs(AngleToPlayer) < 20 && d < 1.75f)
            {
                animator.ResetTrigger("JumpSlash");
                moveSpeed = 0f;
                animator.SetFloat("X", 0f, 0.1f, Time.deltaTime);
                animator.SetFloat("Y", 0f, 0.1f, Time.deltaTime);
                animator.SetTrigger("At");
                return;
            }
            else
            {
                animator.ResetTrigger("At");
                moveSpeed += (2.5f - moveSpeed) * 0.15f;
                animator.SetFloat("X", 0.55f, 0.1f, Time.deltaTime);
                animator.SetFloat("Y", 0.15f, 0.1f, Time.deltaTime);
                return;
            }
        }

        if (d < DashDistance && JumpSlash_CD > 7 && Mathf.Abs(AngleToPlayer) < 7.5f)
        {
            moveSpeed   += (1.5f - moveSpeed) * 0.15f;
            JumpSlash_CD = 0;
            animator.SetTrigger("JumpSlash");
        }
        else if (d < 3.5f && JumpSlash_CD > 0.5f && JumpSlash_CD < 1.5f)
        {
            moveSpeed += (3f - moveSpeed) * 0.15f;
            Vector3    direction = (destination - transform.position).normalized;
            Quaternion qDir      = Quaternion.LookRotation(direction);
            transform.rotation = Quaternion.Slerp(transform.rotation, qDir, 10 * Time.deltaTime);
            animator.SetTrigger("RotateSlash");
        }
        else if (d < DashDistance && JumpSlash_CD < 7)
        {
            moveSpeed += (3f - moveSpeed) * 0.15f;
            animator.SetFloat("X", 0.65f, 0.1f, Time.deltaTime);
            animator.SetFloat("Y", 0.4f, 0.1f, Time.deltaTime);
        }

        if (d > DashDistance)
        {
            moveSpeed += (3f - moveSpeed) * 0.15f;
            animator.SetFloat("X", 0.15f, 0.1f, Time.deltaTime);
            animator.SetFloat("Y", 0.85f, 0.1f, Time.deltaTime);
        }

        if (d > 20)
        {
            solution = BattleSolution.Runaway;
        }
    }
Esempio n. 2
0
    void Stay()
    {
        destination = Nav.GetCorners();
        moveSpeed  += (1.5f - moveSpeed) * 0.15f;
        animator.SetFloat("X", 0.6f, 0.1f, Time.deltaTime);
        animator.SetFloat("Y", 0.1f, 0.1f, Time.deltaTime);

        if (d < 10 && attackstates == Attackstates.Attacking_OutRange)
        {
            solution  = BattleSolution.Close;
            StateLock = true;
        }
    }
Esempio n. 3
0
    // Solutions
    void Runaway()
    {
        moveSpeed += (3 - moveSpeed) * 0.15f;
        animator.SetFloat("Y", 1, 0.1f, Time.deltaTime);

        if (d < MeleeDistance)
        {
            solution = BattleSolution.Close;
        }
        else if (d < DashDistance)
        {
            animator.SetTrigger("JumpSlash");
        }

        destination = Nav.GetCorners();
    }
Esempio n. 4
0
 void e_Attacking_OutRange()
 {
     Nav.CaculatePlayerMomentum();
     if (!StateLock)
     {
         animator.SetFloat("Speed", 0);
         if (Nav.PlayerMomentum > 1)
         {
             solution  = BattleSolution.Close;
             StateLock = true;
         }
         else if (Nav.PlayerMomentum < -1)
         {
             solution  = BattleSolution.Runaway;
             StateLock = true;
         }
         else
         {
             solution = BattleSolution.Stay;
         }
     }
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     base.Start();
     solution = BattleSolution.Stay;
 }