public bool Execute(BallData ballData, MachineController machineController) { var instructionsSent = _executeFunc(ballData, machineController, _instructionsSentCount); if (instructionsSent) { _instructionsSentCount++; } return(_instructionsSentCount >= _duration); }
public static void MoveToHeightWithXYTiltCorrection(MachineController machineController, ITiltController tiltController, BallData ballData, float height, float moveTime, Vector2?target) { var tilt = tiltController.CalculateTilt( new Vector2(ballData.CurrentPositionVector.x, ballData.CurrentPositionVector.y), new Vector2(ballData.CurrentVelocityVector.x, ballData.CurrentVelocityVector.y), target ?? Vector2.zero, ballData.CalculatedOnBounceDownwardsVelocity, ballData.AirborneTime); var xCorrection = Mathf.Clamp(tilt.xTilt, c.MinTiltAngle, c.MaxTiltAngle); var yCorrection = Mathf.Clamp(tilt.yTilt, c.MinTiltAngle, c.MaxTiltAngle); machineController.SendInstructions(new List <HLInstruction>() { new HLInstruction(height, xCorrection, yCorrection, moveTime), }); }