Exemple #1
0
 public void RemoveBuff(int buffId)
 {
     _buffMgr.RemoveBuff(buffId);
 }
Exemple #2
0
    public void Update()
    {
        if (this.BuffTime > 0)
        {
            this.AccTime += Time.deltaTime;
            if (AccTime >= this.BuffTime)
            {
                if (this.Mgr != null)
                {
                    Mgr.RemoveBuff(this.UID);
                }
                else
                {
                    EDebug.LogErrorFormat("Buff {0} over, Could not find the mgr..", this.BuffId);
                }
            }
        }

        switch (Type)
        {
        case BuffType.Shield:
        {
            if (this.ShieldHP <= 0)
            {
                if (Mgr != null)
                {
                    Mgr.OnShieldBreak(this.BuffId);
                    Mgr.RemoveBuff(this.UID);
                }
                else
                {
                    EDebug.LogErrorFormat("Buff {0} over, Could not find the mgr..", this.BuffId);
                }
            }
        }
        break;

        case BuffType.Times:
        {
            this.AccBuffCD += Time.deltaTime;
            if (this.AccBuffCD >= this.BuffCD)
            {
                if (Mgr != null)
                {
                    Mgr.TakeEffect(this);
                }
                else
                {
                    EDebug.LogErrorFormat("Buff {0} cd over, Could not find the mgr..", this.BuffId);
                }
                this.UseTimes--;
                this.AccBuffCD = 0;
                if (this.UseTimes <= 0)
                {
                    if (Mgr != null)
                    {
                        Mgr.RemoveBuff(this.UID);
                    }
                    else
                    {
                        EDebug.LogErrorFormat("Buff {0} over, Could not find the mgr..", this.BuffId);
                    }
                }
            }
        }
        break;

        default:
            break;
        }
    }