Пример #1
0
    public void init()
    {
        playerObject = GameObject.Find("Player");
        player = playerObject.GetComponent<Player>();
        //controlKeysPosition = new Rect(50, Screen.height - 15 - controlKeys.height, controlKeys.width, controlKeys.height);
        flashlightKeyPosition = rectForSprite(30, 15, flashlightKey, true);
        swordKeyPosition = rectForSprite(flashlightKeyPosition.xMax - 15, 15, swordKey, true);
        lazerKeyPosition = rectForSprite(swordKeyPosition.xMax + 5, 15, lazerKey, true);
        stunKeyPosition = rectForSprite(lazerKeyPosition.xMax + 5, 15, stunKey, true);

        megaBarPosition = new Rect(10, 10, megaBar.width, megaBar.height);
        //megaBarPosition = new Rect(10, 10, 276, 172);
        Debug.Log ("megabar width: " + megaBar.width + " height: " + megaBar.height);
        healthBar = new MegaBarBar();
        healthBar.color = megaBarRed;
        healthBar.pos = new Rect(megaBarPosition.xMin + 117, megaBarPosition.yMin + 33, 118, 47);
        healthBar.maxLength = healthBar.pos.width;
        energyBar = new MegaBarBar();
        energyBar.color = megaBarBlue;
        energyBar.pos = new Rect(healthBar.pos.xMin, healthBar.pos.yMax, 110, 28);
        energyBar.maxLength = healthBar.pos.width;
        staminaBar = new MegaBarBar();
        staminaBar.color = megaBarGreen;
        staminaBar.pos = new Rect(healthBar.pos.xMin, energyBar.pos.yMax, 110, 15);
        staminaBar.maxLength = healthBar.pos.width;
    }
Пример #2
0
    public void init()
    {
        playerObject = GameObject.Find("Player");
        player       = playerObject.GetComponent <Player>();
        //controlKeysPosition = new Rect(50, Screen.height - 15 - controlKeys.height, controlKeys.width, controlKeys.height);
        flashlightKeyPosition = rectForSprite(30, 15, flashlightKey, true);
        swordKeyPosition      = rectForSprite(flashlightKeyPosition.xMax - 15, 15, swordKey, true);
        lazerKeyPosition      = rectForSprite(swordKeyPosition.xMax + 5, 15, lazerKey, true);
        stunKeyPosition       = rectForSprite(lazerKeyPosition.xMax + 5, 15, stunKey, true);

        megaBarPosition = new Rect(10, 10, megaBar.width, megaBar.height);
        //megaBarPosition = new Rect(10, 10, 276, 172);
        Debug.Log("megabar width: " + megaBar.width + " height: " + megaBar.height);
        healthBar            = new MegaBarBar();
        healthBar.color      = megaBarRed;
        healthBar.pos        = new Rect(megaBarPosition.xMin + 117, megaBarPosition.yMin + 33, 118, 47);
        healthBar.maxLength  = healthBar.pos.width;
        energyBar            = new MegaBarBar();
        energyBar.color      = megaBarBlue;
        energyBar.pos        = new Rect(healthBar.pos.xMin, healthBar.pos.yMax, 110, 28);
        energyBar.maxLength  = healthBar.pos.width;
        staminaBar           = new MegaBarBar();
        staminaBar.color     = megaBarGreen;
        staminaBar.pos       = new Rect(healthBar.pos.xMin, energyBar.pos.yMax, 110, 15);
        staminaBar.maxLength = healthBar.pos.width;
    }
Пример #3
0
 void drawMegaBarBar(MegaBarBar bar, float percent, bool lowFlashAndTrailingYellow = true)
 {
     if (lowFlashAndTrailingYellow)
     {
         drawPercentBar((int)bar.pos.xMin, (int)bar.pos.yMin, (int)bar.maxLength, (int)bar.pos.height, percent, bar.color, null, bar.lastPercent, true, 2);
     }
     else
     {
         drawPercentBar((int)bar.pos.xMin, (int)bar.pos.yMin, (int)bar.maxLength, (int)bar.pos.height, percent, bar.color, null, 0, false, 2);
     }
     bar.lastPercent = Mathf.Max(percent, bar.lastPercent - 0.001F);
 }
Пример #4
0
 void drawMegaBarBar(MegaBarBar bar, float percent, bool lowFlashAndTrailingYellow = true)
 {
     if (lowFlashAndTrailingYellow) {
         drawPercentBar((int)bar.pos.xMin, (int)bar.pos.yMin, (int)bar.maxLength, (int)bar.pos.height, percent, bar.color, null, bar.lastPercent, true, 2);
     } else {
         drawPercentBar((int)bar.pos.xMin, (int)bar.pos.yMin, (int)bar.maxLength, (int)bar.pos.height, percent, bar.color, null, 0, false, 2);
     }
     bar.lastPercent = Mathf.Max(percent, bar.lastPercent - 0.001F);
 }