Skip to content

Instantly share code, notes, and snippets.

@v0xel1337
Last active April 16, 2024 13:09
Show Gist options
  • Save v0xel1337/3a46a5daa62317421086135ce25a1b42 to your computer and use it in GitHub Desktop.
Save v0xel1337/3a46a5daa62317421086135ce25a1b42 to your computer and use it in GitHub Desktop.
private void CreateMines()
{
while (mineCount > 0)
{
int index = Random.Range(0, base.transform.childCount);
GameObject gameObject = base.transform.GetChild(index).gameObject;
if (gameObject != null)
{
if (!gameObject.GetComponent<MinePlate>().isMine)
{
gameObject.GetComponent<MinePlate>().isMine = true;
gameObject.GetComponent<MinePlate>().UpdateNearbyTileMineCounts();
mineCount--;
}
continue;
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment