示例#1
0
    /// <summary>
    /// Checks the change in the Color of the status bar.
    /// </summary>
    private void CheckChange()
    {
        if (hitpoint <= 100 && hitpoint > 75)
        {
            currentState = BATTERY_STATES.BATTERY_GREEN;
            ChangeColor();
        }
        else if (hitpoint <= 75 && hitpoint > 50)
        {
            currentState = BATTERY_STATES.BATTERY_YELLOW;
            ChangeColor();
        }

        else if (hitpoint <= 50 && hitpoint > 25)
        {
            currentState = BATTERY_STATES.BATTERY_ORANGE;
            ChangeColor();
        }

        else if (hitpoint <= 25 && hitpoint > 0)
        {
            currentState = BATTERY_STATES.BATTERY_RED;
            ChangeColor();
        }
        else if (hitpoint == 0)
        {
            currentState = BATTERY_STATES.BATTERY_DEAD;
            ChangeColor();
            Application.LoadLevel(Application.loadedLevel);
        }
    }
示例#2
0
 private void Start()
 {
     currentState = BATTERY_STATES.BATTERY_GREEN;
 }