Esempio n. 1
0
    // Object update function
    public virtual void Update()
    {
        // Repair Counter
        if (m_CSRepair != null)
        {
            m_Data.m_CurRepairTime = m_CSRepair.CurCounter;
            m_Data.m_RepairTime    = m_CSRepair.FinalCounter;
            m_Data.m_RepairValue   = m_RepairValue;
        }
        else
        {
            m_Data.m_CurRepairTime = 0F;
            m_Data.m_RepairTime    = -1F;
        }

        // Delet Counter
        if (m_CSDelete != null)
        {
            m_Data.m_CurDeleteTime = m_CSDelete.CurCounter;
            m_Data.m_DeleteTime    = m_CSDelete.FinalCounter;
        }
        else
        {
            m_Data.m_CurDeleteTime = 0F;
            m_Data.m_DeleteTime    = -1F;
        }

        // Health state
        if (m_HurtTime >= cHSRetainTime)
        {
            m_HealthState &= (~CSConst.ehtHurt);
        }
        else
        {
            m_HurtTime += Time.deltaTime;
        }

        if (m_RestoreTime >= cHSRetainTime)
        {
            m_HealthState &= (~CSConst.ehtRestore);
        }
        else
        {
            m_HurtTime += Time.deltaTime;
        }
        if (PeGameMgr.IsSingle || (PeGameMgr.IsMulti && _Net != null && _Net.TeamId == BaseNetwork.MainPlayer.TeamId))
        {
            if (DurabilityPercent <= 0.1f)
            {
                if (tipsCounter0 % tipsIntervalFrameDurabilityLow == 0)
                {
                    //CSUtils.ShowTips(ColonyStatusWarning.DURABILITY_LOW,Name);
                    CSUtils.ShowTips(ColonyStatusWarning.DURABILITY_LOW, Name);
                    tipsCounter0 = 0;
                }
                tipsCounter0++;
            }
            else
            {
                tipsCounter0 = 0;
            }
        }
    }