public void Set_Current_Game_State(Game_States Game_State) { if (Debugging) { Debug.Log("Set_Current_Game_State called: Current_Game_State set to " + Game_State.ToString()); } Current_Game_State = Game_State; }
private SoundManager SndGame; //Class to Manager the Soundseffects #endregion #region Constructor public Game_Logic(int NumMaxPLayer) { int x; SndGame = new SoundManager(); /**********Creation Logic Game ********/ GameState = Game_States.INTRO; LstState = Game_States.INTRO; ScrennState = Game_SCR.RUNNING; CurrentPlayer = 0; MaxPlayers = NumMaxPLayer; Players = new Game_Player[MaxPlayers]; for (x = 0; x < MaxPlayers; x++) { Players[x] = new Game_Player(); } //Only the Player 1 Is connected (use the KeyBoard) AddPlayer("Player 1", 1); //Defino Personaje Por Player Players[0].PlySelect = 1; //Players[1].PlySelect = 4; //Players[2].PlySelect = 5; //Players[3].PlySelect = 8; Players[1].PlySelect = 2; Players[2].PlySelect = 3; Players[3].PlySelect = 4; /*** History ****/ HistoryIni = new string[8]; HistoryEnd = new string[8]; CreateHistory(); //Weapons Weapons = new Game_Weapon[MaxPlayers]; MaxWeapons = NumMaxPLayer; //pause PauseGame = false; //Initial Level Level = 0; LevelH = 10; //Mode Multiplayer MultiMode = Play_MultiMode.DEATHMATCH; //Mode of Game Mode = Game_Mode.MULTI_PLY; //Status Pause_Status = Pausa_Status.RETURN; }
// Use this for initialization void Awake() { if (instance == null) instance = this; else if (instance != this) Destroy(gameObject); current_state = Game_States.START; DontDestroyOnLoad(gameObject); scene_loaded = false; Init(); }
void CalculateAIAndInstantiateSphere() { // //Hard Strategy // Ai_Comp = new AICompMinimax(grid); Ai_Comp.setChance(AIComp.Chance.COMP); // //Easy Strategy // //This function performs tasks for AI and plays the computer chance // bool found = false; // int sphere_box = -1; // while (!found) { // int next_box = Random.Range(0,8); // if(grid[next_box] == 0) // { // sphere_box = next_box; // found = true; // grid[sphere_box] = 2; // steps++; // } // } int sphere_box = Ai_Comp.move(); int[] center = ComputeCenter(sphere_box); grid[sphere_box] = 2; steps++; Debug.Log("Instantiating Sphere"); Instantiate(sphere, new Vector3(center [0], center [1], 0), Quaternion.identity); Game_States current_state = CheckPattern(2); if (current_state == Game_States.COMP_WON) { //End the game and display Player wins Debug.Log("Comp Won"); } else { //This will start the process for comp hasUserPlayed = false; } Debug.Log("Click User"); }
//This method will be called for comp and player both void InstantiateCross(int[] center) { //Here we need to check the input and detemine the center where the prefab needs to be placed //ReturnCenter also needs to marks the square with 1 //Instantiate cross for the user Instantiate(cross, new Vector3(center [0], center [1], 0), Quaternion.identity); //Now compute the logic Game_States current_state = CheckPattern(1); if (current_state == Game_States.PLAYER_WON) { //End the game and display Player wins Debug.Log("Player Won"); } else { //This will start the process for comp if (steps < 9) { continueComp = true; } } }
public Game_States CheckPattern(int chance) { //Now we can check Pattern here Debug.Log("Checking Pattern " + chance); Game_States myState = Game_States.CONTINUE; bool state = false; //This is to check if any one has won switch (lastBox) { case 0: if ((grid[1] == chance && grid[2] == chance) || (grid[3] == chance && grid[6] == chance) || (grid[4] == chance && grid[8] == chance)) { state = true; } break; case 1: if ((grid[0] == chance && grid[2] == chance) || (grid[4] == chance && grid[7] == chance)) { state = true; } break; case 2: if ((grid[0] == chance && grid[1] == chance) || (grid[5] == chance && grid[8] == chance) || (grid[4] == chance && grid[6] == chance)) { state = true; } break; case 3: if ((grid[0] == chance && grid[6] == chance) || (grid[4] == chance && grid[5] == chance)) { state = true; } break; case 4: if ((grid[0] == chance && grid[8] == chance) || (grid[1] == chance && grid[7] == chance) || (grid[2] == chance && grid[6] == chance) || (grid[3] == chance && grid[5] == chance)) { state = true; } break; case 5: if ((grid[3] == chance && grid[4] == chance) || (grid[2] == chance && grid[8] == chance)) { state = true; } break; case 6: if ((grid[0] == chance && grid[3] == chance) || (grid[7] == chance && grid[8] == chance) || (grid[2] == chance && grid[4] == chance)) { state = true; } break; case 7: if ((grid[1] == chance && grid[4] == chance) || (grid[6] == chance && grid[8] == chance)) { state = true; } break; case 8: if ((grid[2] == chance && grid[5] == chance) || (grid[6] == chance && grid[7] == chance) || (grid[0] == chance && grid[4] == chance)) { state = true; } break; } if (state) { if (chance == 1) { myState = Game_States.PLAYER_WON; } else { myState = Game_States.COMP_WON; } } return(myState); }
public Game_Logic(int NumMaxPLayer) { int x; SndGame = new SoundManager(); /**********Creation Logic Game ********/ GameState = Game_States.INTRO; LstState = Game_States.INTRO; ScrennState = Game_SCR.RUNNING; CurrentPlayer = 0; MaxPlayers = NumMaxPLayer; Players = new Game_Player[MaxPlayers]; for (x = 0; x < MaxPlayers; x++) { Players[x] = new Game_Player(); } //Only the Player 1 Is connected (use the KeyBoard) AddPlayer("Player 1", 1); //Defino Personaje Por Player Players[0].PlySelect = 1; //Players[1].PlySelect = 4; //Players[2].PlySelect = 5; //Players[3].PlySelect = 8; Players[1].PlySelect = 2; Players[2].PlySelect = 3; Players[3].PlySelect = 4; /*** History ****/ HistoryIni = new string[8]; HistoryEnd = new string[8]; CreateHistory(); //Weapons Weapons = new Game_Weapon[MaxPlayers]; MaxWeapons = NumMaxPLayer; //pause PauseGame = false; //Initial Level Level = 0; LevelH = 10; //Mode Multiplayer MultiMode = Play_MultiMode.DEATHMATCH; //Mode of Game Mode = Game_Mode.MULTI_PLY; //Status Pause_Status = Pausa_Status.RETURN; }
public void Set_State(Game_States _state) { game_state = _state; }