/// <summary> /// This creates a new match. /// </summary> public void NewMatch() { match = new UserMatch(configuration); user = new Player(match, NAME); match.AddUser(user); var bots = ControllerSkeleton.LoadControllerFolder(Environment.CurrentDirectory + "\\..\\bots"); foreach (ControllerSkeleton bot in bots) { if (bot.Controller.Name == BOTNAME) { computer = match.PlayerCreate(bot); break; } } match.OnEvent += UpdateShot; match.OnEvent += UpdateShotHit; match.OnEvent += UpdateWinner; match.OnEvent += RoundEnd; match.OnEvent += UpdateShipDestroyed; match.Play(); }
private void AttemptPlayMatch() { gridUser.Enabled = true; for (int i = 0; i < shipButtons.Length; i++) { if (shipButtons[i].Visible == true) { gridUser.Enabled = false; } } if (gridUser.Enabled) { match.Play(); // Sometimes Computer player goes first. } }