public bool[] RunFrame() { var action1 = agent1.Act(gs, 1); var action2 = agent2.Act(gs, 2); bool[] frameResult = PacManGameState.Step(gs, action1, action2, speed); agent1.Obs((frameResult[0] ? 1F : 0F), frameResult[2]); agent1.Obs((frameResult[1] ? 1F : 0F), frameResult[2]); return(frameResult); }
// Update is called once per frame void Update() { if (gs.isGameOver) { StopAllCoroutines(); return; } if (!gameStarted) { return; } //echap pour mettre le jeu en pause if (Input.GetKeyDown(KeyCode.Escape)) { if (gs.isPaused == false) { gs.isPaused = true; IMS.Pause(gs.isPaused); } else { gs.isPaused = false; IMS.Pause(gs.isPaused); } } if (gs.isPaused) { return; } IMS.UpdateScore(gs.playerScore1, gs.playerScore2); if (gs.playerScore1 >= 3 || gs.playerScore2 >= 3) { IMS.FinDePartie(); gs.isGameOver = true; } PlayerView1.position = gs.playerPosition1; PlayerView2.position = gs.playerPosition2; frisbeeView.position = gs.frisbeePosition; Rules.Step(ref gs, agentJ1.Act(ref gs, Rules.GetAvailableActions1(ref gs)), agentJ2.Act(ref gs, Rules.GetAvailableActions2(ref gs))); }