Example #1
0
    /// <summary>
    /// Should be called everytime LevelInventory changes. Updates the Sprite slots.
    /// </summary>
    private void OnInventoryChange()
    {
        for (int i = 0; i < spriteSlots.Length; i++)
        {
            spriteSlots [i].sprite = Powerup.GetSprite(pwrInventory [i]);

            // Set sprite alpha to zero or white block will be shown if sprite is null
            if (spriteSlots [i].sprite == null)
            {
                spriteSlots [i].color = new Color(1, 1, 1, 0);
            }
            else
            {
                spriteSlots [i].color = new Color(1, 1, 1, 1);
            }
        }
    }