예제 #1
0
    public static void AddBugs(int amount)
    {
        CurrentBugCount += amount;

        for (int i = 0; i < amount; i++)
        {
            EventContext.AddEvent("Bug");
        }

        if (OnBugCountChange != null)
        {
            OnBugCountChange(amount);
        }
    }
예제 #2
0
    public static void AddCredits(int amount)
    {
        CurrentCreditCount += amount;

        for (int i = 0; i < amount; i++)
        {
            EventContext.AddEvent("Credit");
        }

        if (OnCreditChange != null)
        {
            OnCreditChange(amount);
        }
    }
예제 #3
0
    public static void RemoveSingleLife()
    {
        if (LivesCount == 0)
        {
            EventContext.AddEvent("NoLivesRemaining");
        }

        if (LivesCount > 0)
        {
            LivesCount--;
        }
        if (OnLifeLost != null)
        {
            OnLifeLost(LivesCount);
        }
    }
예제 #4
0
    // 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);
    }
예제 #5
0
    /// <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");
        }
    }