private void FixedUpdate() { var follow = Script.GetFollowObject(); var dir = follow.x - transform.position.x; if (dir < 0) { dir = -1; } else { dir = 1; } if (!Script.CanMove()) { dir = 0; } Body.velocity = new Vector3(Speed * Time.deltaTime * dir * 4, Body.velocity.y); EnemyAnimator.SetFloat("Speed", Mathf.Abs(Body.velocity.x)); }