Ejemplo n.º 1
0
    /** 每秒十次 */
    public void onPiece(int delay)
    {
        if (!_buffDatas.isEmpty())
        {
            //是客户端驱动
            if (_parent.isSelfDriveAttackHapen())
            {
                //先触发间隔
                if (!_intervalActions.isEmpty())
                {
                    AttributeDataLogic attributeLogic = _parent.attribute;

                    foreach (BuffIntervalActionData v in _intervalActions)
                    {
                        v.timePass += delay;

                        if (v.timePass >= v.delay)
                        {
                            v.timePass -= v.delay;

                            switch (v.type)
                            {
                            case BuffIntervalActionType.Attack:
                            {
                                //触发一次
                                _parent.doBuffIntervalAttack(v);
                            }
                            break;

                            case BuffIntervalActionType.AddAttribute:
                            {
                                if (!_parent.isDriveAll())
                                {
                                    return;
                                }

                                attributeLogic.addOneAttribute(v.key, v.value);
                            }
                            break;

                            case BuffIntervalActionType.AddAttributeVar:
                            {
                                if (!_parent.isDriveAll())
                                {
                                    return;
                                }

                                attributeLogic.addOneAttribute(v.key, _parent.getSkillVarValueT(v.value, v.adderInstanceID));
                            }
                            break;
                            }
                        }
                    }
                }
            }

            foreach (BuffData data in _buffDatas)
            {
                //有持续时间
                if (data.lastTime > 0)
                {
                    if ((data.lastTime -= delay) <= 0)
                    {
                        data.lastTime = 0;

                        //本端驱动才移除
                        if (_parent.isDriveAll())
                        {
                            buffOver(data);
                        }
                    }
                }
            }
        }
    }