protected override void AI() { if (!HasControl || Interacting) { return; } Vector3 Vel = Vector3.zero; Vector3 Forward = CamTr.forward; Forward.y = 0.0f; Forward.Normalize(); Vector3 Right = Vector3.Cross(Forward, Vector3.up); Vel -= Right * Motor.movement.maxSidewaysSpeed * Input.GetAxis("Horizontal"); Vel += Forward * Motor.movement.maxForwardSpeed * Input.GetAxis("Vertical"); if (Interactables.Count > 0 && Input.GetKey(KeyInteract)) { Interacting = true; foreach (GameObject GI in Interactables) { foreach (Interactable I in GI.GetComponents <Interactable>()) { I.OnInteract(this); } } } if (Input.GetKey(KeyDodge) && PlayAnim("Dodge")) { float Length = Vel.magnitude; if (Length <= 0.0f) { Vel = Forward * Motor.movement.maxForwardSpeed; } else { Vel = Vel / Length * Motor.movement.maxForwardSpeed; } } if (Input.GetMouseButton(MouseAttack) && PlayAnim("Attack")) { EquippedWeapon.ResetHits(); } Motor.movement.velocity = Vel; Interactables.Clear(); }