Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (_level >= 3)
        {
            LightBulb _lb = FindObjectOfType <LightBulb>();
            if (!_lb)
            {
                return;
            }
            if (_lb.Switched() || _lb.Glitched())
            {
                // Debug.Log(" in update LC, switched = " + _lb.Switched() + " glitched = " + _lb.Glitched());

                if (!_scoreAdded)
                {
                    _totalCoins += (int)((float)_centiCoinsThisLevel / 100.0);
                    tc_text.text = "Total Coins:  " + _totalCoins;
                    _scoreAdded  = true;
                    if (_lb.Glitched())
                    {
                        glitch_text.color = Color.white;
                    }
                }
            }
            else
            {
                if (_centiCoinsThisLevel > 0)
                {
                    _centiCoinsThisLevel--;
                }
            }
            cc_text.text = "Current Coins:  " + (int)((float)_centiCoinsThisLevel / 100.0);
        }
    }
Пример #2
0
    // Update is called once per frame
    public virtual void Update()
    {
        GameMode mygamemode = FindObjectOfType <GameMode>();

        if (!mygamemode.IsInPlayMode())
        {
            return;
        }
        LightBulb _lb = FindObjectOfType <LightBulb>();

        if (!_lb)
        {
            return;
        }
        if (_lb.Switched() || _lb.Glitched())
        {
            // Debug.Log(" in update LC, switched = " + _lb.Switched() + " glitched = " + _lb.Glitched());
            cc_text.color = Color.gray;
            if (!_scoreAdded)
            {
                _totalCoins += (int)((float)_centiCoinsThisLevel / 100.0);
                tc_text.text = "Total Coins:  " + _totalCoins;
                _scoreAdded  = true;
                if (_lb.Glitched())
                {
                    glitch_text.color = Color.white;
                }
            }
        }
        else
        {
            if (_centiCoinsThisLevel > 0)
            {
                _centiCoinsThisLevel--;
            }
        }
        cc_text.text = "Current Coins:  " + (int)((float)_centiCoinsThisLevel / 100.0);
    }