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; } }
// Update is called once per frame protected override void Update() { base.Update(); destination = Nav.GetCorners(); if (player.activeSelf == true) { d = Vector3.Distance(player.transform.position, transform.position); } animator.SetFloat("Speed", speed); }
public override void UpdateAttackState() { base.UpdateAttackState(); if (attackstates == Attackstates.Attacking) { destination = Nav.GetCorners(); if (d > BattleRange) { attackstates = Attackstates.Attacking_OutRange; animator.SetBool("IsLock", true); } } }
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; } }
// 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(); }