コード例 #1
0
ファイル: BSBase.cs プロジェクト: niuniuzhu/Lockstep
        internal void Update(UpdateContext context)
        {
            if (!this._enable)
            {
                return;
            }

            this._elapsed += context.deltaTime;

            this.UpdateInternal(context);

            if (this.trigger != null)
            {
                this._triggerDt += context.deltaTime;
                float interval = this.trigger.interval;
                interval = interval < context.deltaTime ? context.deltaTime : interval;
                if (this._triggerDt >= interval)
                {
                    SyncEventHelper.BuffStateTriggered(this.owner.rid, this.id, this._triggerIndex);

                    this.TriggerAttr(this._triggerIndex);

                    ++this._triggerIndex;
                    this._triggerDt -= interval;
                }
            }

            if (this.duration >= 0f && this._elapsed >= this.duration)
            {
                this.TimeupInternal();
                this.owner.DestroyBuffState(this);
            }
        }