m |
m |
||
| Line 9: | Line 9: | ||
* <span style="color: violet;">GameController.cs</span>: Handles game events and triggers deck shuffling and state changes:<br> `GameModel.ShuffleDeck()`, `GameModel.GameStateActivate(GameState.GameStateType.mulliganDraw)`.<br><br> | * <span style="color: violet;">GameController.cs</span>: Handles game events and triggers deck shuffling and state changes:<br> `GameModel.ShuffleDeck()`, `GameModel.GameStateActivate(GameState.GameStateType.mulliganDraw)`.<br><br> | ||
* <span style="color: violet;">Gameplay.cs</span>: Manages the flow of the game, including player interactions and calling shuffle methods:<br> `GameModel.ShuffleDeck(1)`.<br><br> | * <span style="color: violet;">Gameplay.cs</span>: Manages the flow of the game, including player interactions and calling shuffle methods:<br> `GameModel.ShuffleDeck(1)`.<br><br> | ||
| − | * <span style="color: violet;"> | + | * <span style="color: violet;">GameState.cs</span>: Defines game states and manages the logic for drawing and shuffling based on state transitions:<br> `case GameStateType.draw:`, `case GameStateType.mulliganDraw:`.<br><br> |
| style="vertical-align: top;" | | | style="vertical-align: top;" | | ||
* Shuffle | * Shuffle | ||

| |
|
|---|---|
|
|
| | |
| |
| | |
| This code is a collection of all the functions involved in the shuffle mechanic, though it doesn't exist as a single block in any one file. The complete shuffle logic is primarily found in GameModel.cs. | |
// GameModel.cs public static void ShuffleDeck(int side) { // Logic for shuffling the deck for the specified player side Random.State state = Random.state; // Save the current random state Random.InitState(num); // Initialize random state with a seed int index = Random.Range(0, model.players[side].deck.Count); // Get a random index OnDeckShuffled(side); // Call deck shuffled event gameData.shuffledDeckThisTurn[side]++; // Increment the shuffle counter Random.state = state; // Restore the previous random state Debug.Log("Shuffled deck for side " + side + ", seed " + num); // Log shuffle info } public static void ShuffleDeck() { ShuffleDeck(CurSide()); // Calls the shuffle method for the current player side } // Additional functions related to deck manipulation public static void RemoveDeck(ShadowEraCard card) { // Logic for removing a card from the deck } // GameController.cs GameModel.ShuffleDeck(); // Called to trigger the shuffle process GameModel.GameStateActivate(GameState.GameStateType.mulliganDraw); // Changes the game state for a mulligan // Gameplay.cs GameModel.ShuffleDeck(1); // Executes the shuffle for player 1 // GameState.cs case GameStateType.draw: { // Logic for handling the draw state after a shuffle } case GameStateType.mulliganDraw: { // Logic for handling the mulligan draw state, ensuring shuffle occurs correctly } | |