Last active
October 6, 2017 06:45
-
-
Save AndrewWeston9/84f384e7320ab3700a03ba09ec911e1c to your computer and use it in GitHub Desktop.
WorldManager.cs Snippet: Generating different blocks at the start, randomly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int k = 0; k < MaxBlockHeight; k += 1) | |
{ | |
if (k < zc) | |
{ | |
int rand = (int) UnityEngine.Random.Range (0f, 100f); | |
if (rand <= 70) | |
{ | |
blockStructure [getIndex (i, j, k)].brickType = 1; | |
blockStructure [getIndex (i, j, k)].brickHealth = 1; | |
blockStructure [getIndex (i, j, k)].playerConnectionId = -1; | |
} | |
else if (rand >= 71 && rand <= 85) | |
{ | |
blockStructure [getIndex (i, j, k)].brickType = 5; | |
blockStructure [getIndex (i, j, k)].brickHealth = 2; | |
blockStructure [getIndex (i, j, k)].playerConnectionId = -1; | |
} | |
else if (rand >= 86 && rand <= 95) | |
{ | |
blockStructure [getIndex (i, j, k)].brickType = 6; | |
blockStructure [getIndex (i, j, k)].brickHealth = 5; | |
blockStructure [getIndex (i, j, k)].playerConnectionId = -1; | |
} | |
else if (rand >= 96) | |
{ | |
blockStructure [getIndex (i, j, k)].brickType = 7; | |
blockStructure [getIndex (i, j, k)].brickHealth = 10; | |
blockStructure [getIndex (i, j, k)].playerConnectionId = -1; | |
} | |
} | |
else | |
{ | |
blockStructure[getIndex (i, j, k)].brickType = 0; | |
blockStructure [getIndex (i, j, k)].brickHealth = 0; | |
blockStructure [getIndex (i, j, k)].playerConnectionId = -2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment