// Update is called once per frame void Update() { if (engage && grounded) { players = aiController.GetPlayers(); if (players.Length > 0) { GetTarget(); } if (closestPlayer != null) { ManageSensors(); aiMovement.ManageAxisInput(axisX, ref lerpX, lerpLimitX); aiMovement.ManageAxisInput(axisY, ref lerpY, lerpLimitY); float inputY = lerpY / lerpLimitY; aiMovement.Move(inputY, transform); // lerp / lerpLimit dictates the percentage of movement ManageMovementParticles(inputY); aiMovement.Rotate(lerpX / lerpLimitX, transform); aiAiming.AimTurret(playerTarget); if (players.Length > 0 && aiAiming.CheckIfReadyToFire()) { ManageFireInput(); } CheckToEvade(); } else { aiMovement.Move(0, transform); ManageMovementParticles(0); } } }