// FixedUpdate is called once per physics step. If we are broken, move randomly, otherwise patrol along waypoints private void FixedUpdate() { if (detectTimer > 0) { if (!isIdle) { isIdle = true; animator.SetBool("isIdle", true); changeFlag = true; } detectTimer -= Time.deltaTime; } else { if (changeFlag) { isIdle = !isIdle; if (isIdle) { animator.SetBool("isIdle", true); } else { animator.SetBool("isIdle", false); } changeFlag = false; } } if (breakType != 4 && detectTimer <= 0) { moveTimer -= Time.deltaTime; RandomMovement(); } if (breakType == 4) { waypointController.Move(); } }
// Update is called once per frame void FixedUpdate() { waypointController.Move(); }