public static void AddBugs(int amount) { CurrentBugCount += amount; for (int i = 0; i < amount; i++) { EventContext.AddEvent("Bug"); } if (OnBugCountChange != null) { OnBugCountChange(amount); } }
public static void AddCredits(int amount) { CurrentCreditCount += amount; for (int i = 0; i < amount; i++) { EventContext.AddEvent("Credit"); } if (OnCreditChange != null) { OnCreditChange(amount); } }
public static void RemoveSingleLife() { if (LivesCount == 0) { EventContext.AddEvent("NoLivesRemaining"); } if (LivesCount > 0) { LivesCount--; } if (OnLifeLost != null) { OnLifeLost(LivesCount); } }
// Use this for initialization void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 50), "Win")) { EventContext.AddEvent("Win"); } if (GUI.Button(new Rect(10, 60, 100, 50), "Die")) { EventContext.AddEvent("Dead"); } if (GUI.Button(new Rect(10, 120, 100, 50), "Reload")) { Application.LoadLevel("EmptyTest"); } GUI.TextArea(new Rect(10, 180, 100, 50), message); }
/// <summary> /// Reduces the 0 to 100 life by an amount. /// </summary> /// <param name='amount'> /// The amount to reduce from the life meter /// </param> public static void ReduceLife(float amount) { if (amount >= CurrentLife) { CurrentLife = 0; RemoveSingleLife(); } else { CurrentLife -= amount; } EventContext.AddEvent("ReducedLife"); if (OnReducedLife != null) { OnReducedLife(); } if (CurrentLife == 0) { EventContext.AddEvent("Dead"); } }