m |
m |
||
| Line 64: | Line 64: | ||
#'''Ease of Use'''<br>The use of methods like `Random.Range` allows developers to [https://docs.unity3d.com/ScriptReference/Random.html quickly obtain random values within specific ranges], thereby facilitating the implementation of game logic.<br><br> | #'''Ease of Use'''<br>The use of methods like `Random.Range` allows developers to [https://docs.unity3d.com/ScriptReference/Random.html quickly obtain random values within specific ranges], thereby facilitating the implementation of game logic.<br><br> | ||
#'''Applications in Games'''<br>Many games developed in Unity ([https://en.wikipedia.org/wiki/Hollow_Knight Hollow Knight], [https://en.wikipedia.org/wiki/Among_Us Among Us] & [https://en.wikipedia.org/wiki/Legends_of_Runeterra Legends of Runeterra]) use this method for mechanics such as card drawing, enemy placement, and other random elements. This would demonstrate its robustness and effectiveness in real game scenarios. | #'''Applications in Games'''<br>Many games developed in Unity ([https://en.wikipedia.org/wiki/Hollow_Knight Hollow Knight], [https://en.wikipedia.org/wiki/Among_Us Among Us] & [https://en.wikipedia.org/wiki/Legends_of_Runeterra Legends of Runeterra]) use this method for mechanics such as card drawing, enemy placement, and other random elements. This would demonstrate its robustness and effectiveness in real game scenarios. | ||
| + | <center><img src="https://www.shadowera.com/landing/img/blog-separator-2.png" ></center><br> | ||
| + | [[Category: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. | |
//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
