@galacean/engine 1.3.14 → 1.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -30896,16 +30896,17 @@
30896
30896
  * @internal
30897
30897
  */ _proto._onDisableInScene = function _onDisableInScene() {
30898
30898
  var componentsManager = this.scene._componentsManager;
30899
+ var prototype = Script.prototype;
30899
30900
  if (!this._started) {
30900
30901
  componentsManager.removeOnStartScript(this);
30901
30902
  }
30902
- if (this._onUpdateIndex >= 0) {
30903
+ if (this.onUpdate !== prototype.onUpdate) {
30903
30904
  componentsManager.removeOnUpdateScript(this);
30904
30905
  }
30905
- if (this._onLateUpdateIndex >= 0) {
30906
+ if (this.onLateUpdate !== prototype.onLateUpdate) {
30906
30907
  componentsManager.removeOnLateUpdateScript(this);
30907
30908
  }
30908
- if (this._onPhysicsUpdateIndex >= 0) {
30909
+ if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
30909
30910
  componentsManager.removeOnPhysicsUpdateScript(this);
30910
30911
  }
30911
30912
  this._entity._removeScript(this);
@@ -32875,7 +32876,8 @@
32875
32876
  var _proto = AnimatorStatePlayData.prototype;
32876
32877
  _proto.reset = function reset(state, stateData, offsetFrameTime) {
32877
32878
  this.state = state;
32878
- this.frameTime = offsetFrameTime;
32879
+ this.playedTime = 0;
32880
+ this.offsetFrameTime = offsetFrameTime;
32879
32881
  this.stateData = stateData;
32880
32882
  this.playState = AnimatorStatePlayState.UnStarted;
32881
32883
  this.clipTime = state.clipStartTime * state.clip.length;
@@ -32894,9 +32896,9 @@
32894
32896
  }
32895
32897
  };
32896
32898
  _proto.update = function update(deltaTime) {
32897
- this.frameTime += deltaTime;
32899
+ this.playedTime += deltaTime;
32898
32900
  var state = this.state;
32899
- var time = this.frameTime;
32901
+ var time = this.playedTime + this.offsetFrameTime;
32900
32902
  var duration = state._getDuration();
32901
32903
  this.playState = AnimatorStatePlayState.Playing;
32902
32904
  if (state.wrapMode === exports.WrapMode.Loop) {
@@ -33340,9 +33342,8 @@
33340
33342
  var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
33341
33343
  var playCostTime;
33342
33344
  if (transition) {
33343
- var clipDuration = state.clip.length;
33344
- var clipEndTime = state.clipEndTime * clipDuration;
33345
- var exitTime = transition.exitTime * state._getDuration();
33345
+ var clipEndTime = state._getClipActualEndTime();
33346
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
33346
33347
  if (isForwards) {
33347
33348
  if (exitTime < lastClipTime) {
33348
33349
  playCostTime = exitTime + clipEndTime - lastClipTime;
@@ -33350,7 +33351,7 @@
33350
33351
  playCostTime = exitTime - lastClipTime;
33351
33352
  }
33352
33353
  } else {
33353
- var startTime = state.clipStartTime * clipDuration;
33354
+ var startTime = state._getClipActualStartTime();
33354
33355
  if (lastClipTime < exitTime) {
33355
33356
  playCostTime = clipEndTime - exitTime + lastClipTime - startTime;
33356
33357
  } else {
@@ -33412,18 +33413,20 @@
33412
33413
  var lastDestClipTime = destPlayData.clipTime, lastDstPlayState = destPlayData.playState;
33413
33414
  var dstPlayCostTime;
33414
33415
  if (destPlayData.isForwards) {
33415
- dstPlayCostTime = lastDestClipTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : dstPlayDeltaTime;
33416
+ // The time that has been played
33417
+ var playedTime = destPlayData.playedTime;
33418
+ dstPlayCostTime = playedTime + dstPlayDeltaTime > transitionDuration ? transitionDuration - playedTime : dstPlayDeltaTime;
33416
33419
  } else {
33417
33420
  // The time that has been played
33418
- var playedTime = destStateDuration - lastDestClipTime;
33421
+ var playedTime1 = destPlayData.playedTime;
33419
33422
  dstPlayCostTime = // > transition: The time that will be played is enough to finish the transition
33420
- playedTime - dstPlayDeltaTime > transitionDuration ? playedTime - transitionDuration : dstPlayDeltaTime;
33423
+ playedTime1 - dstPlayDeltaTime > transitionDuration ? playedTime1 - transitionDuration : dstPlayDeltaTime;
33421
33424
  }
33422
33425
  var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
33423
33426
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
33424
33427
  srcPlayData.update(srcPlayCostTime);
33425
33428
  destPlayData.update(dstPlayCostTime);
33426
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
33429
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
33427
33430
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
33428
33431
  var crossFadeFinished = crossWeight === 1.0;
33429
33432
  if (crossFadeFinished) {
@@ -33473,16 +33476,18 @@
33473
33476
  var lastDestClipTime = destPlayData.clipTime, lastPlayState = destPlayData.playState;
33474
33477
  var dstPlayCostTime;
33475
33478
  if (destPlayData.isForwards) {
33476
- dstPlayCostTime = lastDestClipTime + playDeltaTime > transitionDuration ? transitionDuration - lastDestClipTime : playDeltaTime;
33479
+ // The time that has been played
33480
+ var playedTime = destPlayData.playedTime;
33481
+ dstPlayCostTime = playedTime + playDeltaTime > transitionDuration ? transitionDuration - playedTime : playDeltaTime;
33477
33482
  } else {
33478
33483
  // The time that has been played
33479
- var playedTime = stateDuration - lastDestClipTime;
33484
+ var playedTime1 = destPlayData.playedTime;
33480
33485
  dstPlayCostTime = // > transition: The time that will be played is enough to finish the transition
33481
- playedTime - playDeltaTime > transitionDuration ? playedTime - transitionDuration : playDeltaTime;
33486
+ playedTime1 - playDeltaTime > transitionDuration ? playedTime1 - transitionDuration : playDeltaTime;
33482
33487
  }
33483
33488
  var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
33484
33489
  destPlayData.update(dstPlayCostTime);
33485
- var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
33490
+ var crossWeight = Math.abs(destPlayData.playedTime) / transitionDuration;
33486
33491
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
33487
33492
  var crossFadeFinished = crossWeight === 1.0;
33488
33493
  if (crossFadeFinished) {
@@ -33610,10 +33615,9 @@
33610
33615
  _proto._checkSubTransition = function _checkSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
33611
33616
  var state = playState.state;
33612
33617
  var transitionIndex = playState.currentTransitionIndex;
33613
- var duration = state._getDuration();
33614
33618
  for(var n = transitions.length; transitionIndex < n; transitionIndex++){
33615
33619
  var transition = transitions[transitionIndex];
33616
- var exitTime = transition.exitTime * duration;
33620
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
33617
33621
  if (exitTime > curClipTime) {
33618
33622
  break;
33619
33623
  }
@@ -33633,10 +33637,9 @@
33633
33637
  _proto._checkBackwardsSubTransition = function _checkBackwardsSubTransition(layerIndex, layerData, layer, playState, transitions, lastClipTime, curClipTime, aniUpdate) {
33634
33638
  var state = playState.state;
33635
33639
  var transitionIndex = playState.currentTransitionIndex;
33636
- var duration = playState.state._getDuration();
33637
33640
  for(; transitionIndex >= 0; transitionIndex--){
33638
33641
  var transition = transitions[transitionIndex];
33639
- var exitTime = transition.exitTime * duration;
33642
+ var exitTime = transition.exitTime * state._getDuration() + state._getClipActualStartTime();
33640
33643
  if (exitTime < curClipTime) {
33641
33644
  break;
33642
33645
  }
@@ -34259,6 +34262,16 @@
34259
34262
  }
34260
34263
  }
34261
34264
  };
34265
+ /**
34266
+ * @internal
34267
+ */ _proto._getClipActualStartTime = function _getClipActualStartTime() {
34268
+ return this._clipStartTime * this.clip.length;
34269
+ };
34270
+ /**
34271
+ * @internal
34272
+ */ _proto._getClipActualEndTime = function _getClipActualEndTime() {
34273
+ return this._clipEndTime * this.clip.length;
34274
+ };
34262
34275
  _create_class$2(AnimatorState, [
34263
34276
  {
34264
34277
  key: "transitions",
@@ -48150,7 +48163,7 @@
48150
48163
  ], EXT_texture_webp);
48151
48164
 
48152
48165
  //@ts-ignore
48153
- var version = "1.3.14";
48166
+ var version = "1.3.15";
48154
48167
  console.log("Galacean engine version: " + version);
48155
48168
  for(var key in CoreObjects){
48156
48169
  Loader.registerClass(key, CoreObjects[key]);