private void toggleAutopilot(object sender, EventArgs e) { if (autoPilot != null) { if (autoPilotState) { autoPilotState = false; autoPilot.Disengage(); } else { autoPilotState = true; autoPilot.Engage(); } } }
public void Start() { timer = new Timer(); staleObjectsChecker = new Timer(); this.Clock = null; ap = new AutoPilot(this); menuController = new RocketLeagueController(); clockGetter = new BackgroundWorker(); clockGetter.DoWork += this.LocateClock; clockGetter.RunWorkerAsync(); //BackgroundWorker boostGetter = new BackgroundWorker(); //boostGetter.DoWork += this.LocateBoost; //boostGetter.RunWorkerAsync(); carGetter = new BackgroundWorker(); carGetter.DoWork += this.LocateCar; carGetter.RunWorkerAsync(); ballGetter = new BackgroundWorker(); ballGetter.DoWork += this.LocateBall; ballGetter.RunWorkerAsync(); diligentSearcher = new BackgroundWorker(); diligentSearcher.DoWork += this.DiligentMemorySearcherTask; // diligentSearcher.RunWorkerAsync(); this.timer.Enabled = true; timer.Tick += new EventHandler(onTick); timer.Interval = 1100; this.staleObjectsChecker.Enabled = true; staleObjectsChecker.Tick += new EventHandler(this.CheckStaleObjects); staleObjectsChecker.Interval = 3500; ap.Engage(); }