-
Notifications
You must be signed in to change notification settings - Fork 4
/
BulletMLEquation.cs
41 lines (36 loc) · 1012 Bytes
/
BulletMLEquation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Diagnostics;
namespace BulletMLLib
{
/// <summary>
/// This is an equation used in BulletML nodes.
/// This is an eays way to set up the grammar for all our equations.
/// </summary>
public class BulletMLEquation : Equationator.Equation
{
/// <summary>
/// A randomizer for getting random values
/// </summary>
static private readonly Random GRandom = new Random(DateTime.Now.Millisecond);
public BulletMLEquation()
{
//add the specific functions we will use for bulletml grammar
AddFunction("rand", RandomValue);
AddFunction("rank", GameDifficulty);
}
/// <summary>
/// used as a callback function in bulletml euqations
/// </summary>
/// <returns>The value.</returns>
public float RandomValue()
{
//this value is "$rand", return a random number
return (float)GRandom.NextDouble();
}
public float GameDifficulty()
{
//This number is "$rank" which is the game difficulty.
return GameManager.GameDifficulty();
}
}
}