Esempio n. 1
0
    /// <summary>
    /// 护盾值事件,包括因为护盾损失和恢复在内的一切效果的显现等。
    /// 考虑以后加入Death类,作为静态函数,统一处理。
    /// </summary>
    /// <param name="info"></param>
    private void SPEvent(EventMgr.SPChangeEventInfo info)
    {
        //只负责实现当前挂载单位的效果
        if (info.Unit != this)
        {
            return;
        }

        if (GameCtrl.IsOnlineGame && IsLocal)
        {
            lock (deathRequestMutex)
            {
                if (!sendDeathRequest)
                {
                    if (IsLocal && info.CurrentValue <= 0)
                    {
                        sendDeathRequest = true;
                        Death();
                        DataSync.DestroyObj((byte)attributes.ID);
                    }
                }
            }
        }
        else
        {
            //SP过低,死亡
            if (info.CurrentValue <= 0)
            {
                Death();
            }
        }
    }