m |
m |
||
| Line 1: | Line 1: | ||
| + | __TOC__ | ||
<center><img src="https://www.shadowera.com/landing/img/blog-separator-2.png" ></center><br> | <center><img src="https://www.shadowera.com/landing/img/blog-separator-2.png" ></center><br> | ||
| − | == Code Summary and Detailed Code == | + | ==== Code Summary and Detailed Code ==== |
{| class="wikitable" code-table" | {| class="wikitable" code-table" | ||
| Line 56: | Line 57: | ||
|} | |} | ||
<center><img src="https://www.shadowera.com/landing/img/blog-separator-2.png" ></center><br> | <center><img src="https://www.shadowera.com/landing/img/blog-separator-2.png" ></center><br> | ||
| − | == Randomization explanation == | + | ==== Randomization explanation ==== |
<br> | <br> | ||
Shadow Era does not implement its own card shuffling technique; instead, it relies on the built-in randomization techniques provided by Unity, specifically through the `UnityEngine.Random` class. You can read [https://docs.unity3d.com/Manual/class-Random.html more information in the Unity Website] about this class. This is the [https://docs.unity3d.com/Manual/UnityManual.html Unity User Manual 2022.3]<br> | Shadow Era does not implement its own card shuffling technique; instead, it relies on the built-in randomization techniques provided by Unity, specifically through the `UnityEngine.Random` class. You can read [https://docs.unity3d.com/Manual/class-Random.html more information in the Unity Website] about this class. This is the [https://docs.unity3d.com/Manual/UnityManual.html Unity User Manual 2022.3]<br> | ||

| |
|
|---|---|
|
|
| | |
| |
| | |
| 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. | |
//1. GameModel.GetRandomSynced(int minInclusive, int maxExclusive) public static int GetRandomSynced(int minInclusive, int maxExclusive) { Random.State state = Random.state; Random.InitState(num); int result = Random.Range(minInclusive, maxExclusive); Random.state = state; return result; } //2. UnityEngine.Random.Range(int min, int max) int randomValue = UnityEngine.Random.Range(min, max); //3. GameManager.SomeMethod() public void SomeMethod() { return text + "rand=" + UnityEngine.Random.Range(0, 99999) + "\\n"; } //4. Gameplay.ExecuteGameplay() public void ExecuteGameplay() { int curEnvironment = UnityEngine.Random.Range(0, 4); } //5. GameState.ActivateGameState() public void ActivateGameState() { GameModel.SetCurSide(Random.Range(0, 2)); } | |

Shadow Era does not implement its own card shuffling technique; instead, it relies on the built-in randomization techniques provided by Unity, specifically through the `UnityEngine.Random` class. You can read more information in the Unity Website about this class. This is the Unity User Manual 2022.3
