public static Game SetupGame(GameModeChoice gameMode, string p1Name, string p2Name) { Game game = null; if (gameMode == GameModeChoice.PvP) { game = new Game(new HumanPlayer(p1Name), new HumanPlayer(p2Name)); } else if (gameMode == GameModeChoice.PvC) { if (ColorMenu.GetColor() == ColorChoice.White) { game = new Game(new HumanPlayer(p1Name), new ComputerPlayer(p2Name)); } else { game = new Game(new ComputerPlayer(p1Name), new HumanPlayer(p2Name)); } } else if (gameMode == GameModeChoice.CvC) { game = new Game(new ComputerPlayer(p1Name), new ComputerPlayer(p2Name)); } return(game); }
void Start() { WaitingUI.SetActive(false); ReadyUI.SetActive(false); InProgressUI.SetActive(false); GameOverUI.SetActive(false); ChangeState(State.Waiting); _cam = Camera.main.GetComponent <CameraHandler>(); // Load the last played game mode if (PlayerPrefs.HasKey("GameMode")) { Debug.LogFormat("Got last played game mode: {0}", PlayerPrefs.GetInt("GameMode")); ModeChoice = (GameModeChoice)(PlayerPrefs.GetInt("GameMode")); } switch (ModeChoice) { case GameModeChoice.LastManStanding: _gameMode = new LMSMode(); break; case GameModeChoice.DeathMatch: _gameMode = new DMMode(10); break; default: Debug.LogErrorFormat("Selected game mode does not exist! Doing LMS."); _gameMode = new LMSMode(); break; } //Spawn points for (int i = 0; i < SpawnPoints.Length; i++) { _spawnPointsOrder.Add(i); } // random order spawnpoints for (int i = 0; i < _spawnPointsOrder.Count; i++) { int temp = _spawnPointsOrder[i]; int rand = Random.Range(0, _spawnPointsOrder.Count); _spawnPointsOrder[i] = _spawnPointsOrder[rand]; _spawnPointsOrder[rand] = temp; } _players = new Dictionary <int, PlayerController> (); PlayerKilled += _gameMode.PlayerKilled; }
public GamePlayView(Game game, int? seed, GameModeChoice gamePlayChoice) : base(game, GameState.Gameplay) { game.GetService<ServerClient>().GamePlay = this; int usedSeed = seed.HasValue ? seed.Value : 0; UniversalRandom.ResetInstance(usedSeed); gameModeChoice = gamePlayChoice; content = new ContentManager(Game.Services, "Content"); UpdateOrder = -1; DrawOrder = -1; }
public static void Main(string[] args) { //args = new string[1] { "isready" }; for (int i = 0; i < args.Length; i++) { if (args[i] == "isready") { bool isQuit = false; while (!isQuit) { GameModeChoice gameMode = MainMenu.GetMode(); if (gameMode == GameModeChoice.Quit) { isQuit = true; } else { string p1Name = "Player 1"; string p2Name = "Player 2"; Game game = SetupGame(gameMode, p1Name, p2Name); if (game != null) { game.Start(); } } } Environment.Exit(0); } } //Random r = new Random(); //int moves = r.Next(30); //Node parent = new Node(); //for(int i=0; i< moves; i++) //{ // List<Node> children = new List<Node>(); // parent.moves.Add(i.ToString(), children); // Random r2 = new Random(); // int submoves = r2.Next(30); // for(int j=0; j<submoves; j++) // { // parent.moves[i.ToString()].Add(new Node()); // } //} //will need a list of parent nodes List <Move> moves = new List <Move>(); Move moveOne = new Move(); moveOne.moveStrength = 5; moveOne.move = "e2e4"; List <Move> moveOneResponses = new List <Move>(); Move moveOneResponseOne = new Move(); moveOneResponseOne.moveStrength = -3; moveOneResponseOne.move = "e7e5"; Move moveOneResponseTwo = new Move(); moveOneResponseTwo.moveStrength = 6; moveOneResponseTwo.move = "d7d5"; moveOneResponses.Add(moveOneResponseOne); moveOneResponses.Add(moveOneResponseTwo); moveOne.responses = moveOneResponses; moves.Add(moveOne); Move moveTwo = new Move(); moveTwo.moveStrength = 6; moveTwo.move = "d2d4"; /// List <Move> moveTwoResponses = new List <Move>(); Move moveTwoResponseOne = new Move(); moveTwoResponseOne.moveStrength = -5; moveTwoResponseOne.move = "e7e5"; Move moveTwoResponseTwo = new Move(); moveTwoResponseTwo.moveStrength = 8; moveTwoResponseTwo.move = "d7d5"; moveTwoResponses.Add(moveTwoResponseOne); moveTwoResponses.Add(moveTwoResponseTwo); /// moveTwo.responses = moveTwoResponses; moves.Add(moveTwo); Move moveToMake = Minimax(1, moves, true); Console.WriteLine("Press any key to escape: "); Console.ReadLine(); }
void Start() { WaitingUI.SetActive(false); ReadyUI.SetActive(false); InProgressUI.SetActive(false); GameOverUI.SetActive(false); ChangeState(State.Waiting); _cam = Camera.main.GetComponent<CameraHandler>(); // Load the last played game mode if (PlayerPrefs.HasKey("GameMode")) { Debug.LogFormat("Got last played game mode: {0}", PlayerPrefs.GetInt("GameMode")); ModeChoice = (GameModeChoice)(PlayerPrefs.GetInt("GameMode")); } switch(ModeChoice) { case GameModeChoice.LastManStanding: _gameMode = new LMSMode(); break; case GameModeChoice.DeathMatch: _gameMode = new DMMode(10); break; default: Debug.LogErrorFormat("Selected game mode does not exist! Doing LMS."); _gameMode = new LMSMode(); break; } //Spawn points for (int i = 0; i < SpawnPoints.Length; i++) { _spawnPointsOrder.Add(i); } // random order spawnpoints for (int i = 0; i < _spawnPointsOrder.Count; i++) { int temp = _spawnPointsOrder[i]; int rand = Random.Range(0, _spawnPointsOrder.Count); _spawnPointsOrder[i] = _spawnPointsOrder[rand]; _spawnPointsOrder[rand] = temp; } _players = new Dictionary<int, PlayerController> (); PlayerKilled += _gameMode.PlayerKilled; }