コード例 #1
0
        internal void Update(UpdateContext context)
        {
            float dt = context.deltaTime;

            this.DoUpdateOrbit(dt);

            bool selected = false;

            if (this._buff.enterStates != null)
            {
                selected = true;
                this.SelectTargets(this._buff.target, true, ref this._tempInOut);
            }

            BuffData.Trigger trigger = this._buff.trigger;
            if (trigger != null && (trigger.times == null || this._triggerIndex <= trigger.times.Length - 1))
            {
                this._triggerDt += dt;
                float interval = trigger.times?[this._triggerIndex] ?? MathUtils.Max(dt, trigger.interval);

                if (this._triggerDt >= interval)
                {
                    SyncEventHelper.BuffTriggered(this._buff.rid, this._triggerIndex);

                    this.DoTriggerOrbit(this._triggerIndex, this._triggerDt);

                    if (!selected)
                    {
                        this.SelectTargets(this._buff.target, false, ref this._tempTargets);
                    }
                    else
                    {
                        this._tempTargets.AddRange(this._tempInOut);
                    }

                    int count = this._tempTargets.Count;
                    for (int i = 0; i < count; i++)
                    {
                        this.OnTargetTrigger(this._tempTargets[i], this._triggerIndex);
                    }

                    this.CreateSummons(this._triggerIndex);

                    this._tempTargets.Clear();

                    ++this._triggerIndex;

                    this._triggerDt -= interval;
                }
            }

            this._time += dt;

            this.UpdateInternal(context);

            if (this._buff.canInterrupt &&
                this._buff.caster.fsm.currState.type != FSMStateType.Attack)
            {
                this._buff.markToDestroy = true;
                return;
            }

            if (this._buff.deadType == DeadType.WithCaster &&
                this._buff.caster.isDead)
            {
                this._buff.markToDestroy = true;
                return;
            }

            if (this._buff.deadType == DeadType.WithMainTarget &&
                this._buff.target.isDead)
            {
                this._buff.markToDestroy = true;
                return;
            }

            if (this._buff.deadType == DeadType.WithTriggerTarget &&
                this._totalTriggerCount >= this._buff.maxTriggerCount)
            {
                this._buff.markToDestroy = true;
                return;
            }

            if (this._buff.duration >= 0 &&
                this._time >= this._buff.duration)
            {
                this._buff.markToDestroy = true;
            }
        }