新增allTweensWithTargetEntity与clearAllCoroutines方法
This commit is contained in:
@@ -9838,6 +9838,7 @@ var es;
|
||||
*/
|
||||
var AbstractTweenable = /** @class */ (function () {
|
||||
function AbstractTweenable() {
|
||||
this.discriminator = "ITweenable";
|
||||
}
|
||||
AbstractTweenable.prototype.recycleSelf = function () {
|
||||
};
|
||||
@@ -10689,6 +10690,13 @@ var es;
|
||||
TweenManager._instance = _this;
|
||||
return _this;
|
||||
}
|
||||
Object.defineProperty(TweenManager, "activeTweens", {
|
||||
get: function () {
|
||||
return this._instance._activeTweens;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
TweenManager.prototype.update = function () {
|
||||
this._isUpdating = true;
|
||||
// 反向循环,这样我们就可以把完成的weens删除了
|
||||
@@ -10774,6 +10782,26 @@ var es;
|
||||
}
|
||||
return foundTweens;
|
||||
};
|
||||
/**
|
||||
* 返回以特定实体为目标的所有tween
|
||||
* Tween返回为ITweenControl
|
||||
* @param target
|
||||
*/
|
||||
TweenManager.allTweensWithTargetEntity = function (target) {
|
||||
var foundTweens = [];
|
||||
for (var i = 0; i < this._instance._activeTweens.length; i++) {
|
||||
if (this._instance._activeTweens[i].discriminator == "ITweenControl") {
|
||||
var tweenControl = this._instance._activeTweens[i];
|
||||
var obj = tweenControl.getTargetObject();
|
||||
if (obj instanceof es.Entity && obj == target ||
|
||||
obj instanceof es.Component && obj.entity == target ||
|
||||
obj instanceof es.Transform && obj.entity == target) {
|
||||
foundTweens.push(this._instance._activeTweens[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundTweens;
|
||||
};
|
||||
/**
|
||||
* 停止所有具有TweenManager知道的特定目标的tweens
|
||||
* @param target
|
||||
@@ -12998,6 +13026,19 @@ var es;
|
||||
_this._shouldRunNextFrame = [];
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* 立即停止并清除所有协程
|
||||
*/
|
||||
CoroutineManager.prototype.clearAllCoroutines = function () {
|
||||
for (var i = 0; i < this._unblockedCoroutines.length; i++) {
|
||||
es.Pool.free(CoroutineImpl, this._unblockedCoroutines[i]);
|
||||
}
|
||||
for (var i = 0; i < this._shouldRunNextFrame.length; i++) {
|
||||
es.Pool.free(CoroutineImpl, this._shouldRunNextFrame[i]);
|
||||
}
|
||||
this._unblockedCoroutines.length = 0;
|
||||
this._shouldRunNextFrame.length = 0;
|
||||
};
|
||||
/**
|
||||
* 将IEnumerator添加到CoroutineManager中
|
||||
* Coroutine在每一帧调用Update之前被执行
|
||||
@@ -13079,6 +13120,10 @@ var es;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (typeof chain.value == 'function') {
|
||||
coroutine.waitForCoroutine = this.startCoroutine(chain.value);
|
||||
return true;
|
||||
}
|
||||
if (chain.value instanceof CoroutineImpl) {
|
||||
coroutine.waitForCoroutine = chain.value;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user