Random Functions

This commit is contained in:
2021-01-30 15:30:35 +08:00
parent ca8149da1f
commit 76edfff94f
334 changed files with 59303 additions and 8 deletions

View File

@@ -14,6 +14,22 @@ public static class FunctionLibrary
return functions[(int)name];
}
public static FunctionName GetNextFunctionName(FunctionName name)
{
return (int)name < functions.Length - 1 ? name + 1 : 0;
}
public static FunctionName GetRandomFunctionName()
{
return (FunctionName)Random.Range(0, functions.Length);
}
public static FunctionName GetRandomFunctionNameOtherThan(FunctionName name)
{
var choice = (FunctionName)Random.Range(1, functions.Length);
return choice == name ? 0 : choice;
}
public static Vector3 Wave(float u, float v, float t)
{
Vector3 p;