Procedural Planets
Integrated Sebastian Lague's Planet Generator Created Tour function in SectorRenderer which makes the camera follow each terrestrial planet in turn
This commit is contained in:
parent
f8165878e0
commit
53a91351b7
332 changed files with 11904 additions and 78 deletions
|
|
@ -0,0 +1,48 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class ChanceTest : MonoBehaviour {
|
||||
public Chance chance;
|
||||
public int total;
|
||||
|
||||
void Update () {
|
||||
if (Input.GetKeyDown (KeyCode.Space)) {
|
||||
chance = new Chance (new System.Random ());
|
||||
total++;
|
||||
if (chance.Percent (10)) {
|
||||
Debug.Log ("1");
|
||||
}
|
||||
if (chance.Percent (70)) {
|
||||
Debug.Log ("7");
|
||||
}
|
||||
if (chance.Percent (20)) {
|
||||
Debug.Log ("2");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Chance {
|
||||
float value;
|
||||
|
||||
public Chance (System.Random prng) {
|
||||
value = (float) prng.NextDouble ();
|
||||
}
|
||||
|
||||
public Chance (PRNG prng) {
|
||||
value = prng.Value ();
|
||||
}
|
||||
|
||||
public bool Percent (float percent) {
|
||||
if (value <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float t = percent / 100f;
|
||||
value -= t;
|
||||
return value <= 0;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue