babylon.action.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. var BABYLON;
  2. (function (BABYLON) {
  3. var Action = (function () {
  4. function Action(trigger, condition) {
  5. this.trigger = trigger;
  6. this._nextActiveAction = this;
  7. this._condition = condition;
  8. }
  9. // Methods
  10. Action.prototype._prepare = function () {
  11. };
  12. Action.prototype._executeCurrent = function () {
  13. if (this._condition) {
  14. var currentRenderId = this._actionManager.getScene().getRenderId();
  15. // We cache the current evaluation for the current frame
  16. if (this._condition._evaluationId === currentRenderId) {
  17. if (!this._condition._currentResult) {
  18. return;
  19. }
  20. } else {
  21. this._condition._evaluationId = currentRenderId;
  22. if (!this._condition.isValid()) {
  23. this._condition._currentResult = false;
  24. return;
  25. }
  26. this._condition._currentResult = true;
  27. }
  28. }
  29. this._nextActiveAction.execute();
  30. if (this._nextActiveAction._child) {
  31. this._nextActiveAction = this._nextActiveAction._child;
  32. } else {
  33. this._nextActiveAction = this;
  34. }
  35. };
  36. Action.prototype.execute = function () {
  37. };
  38. Action.prototype.then = function (action) {
  39. this._child = action;
  40. action._actionManager = this._actionManager;
  41. action._prepare();
  42. return action;
  43. };
  44. Action.prototype._getProperty = function (propertyPath) {
  45. return this._actionManager._getProperty(propertyPath);
  46. };
  47. Action.prototype._getEffectiveTarget = function (target, propertyPath) {
  48. return this._actionManager._getEffectiveTarget(target, propertyPath);
  49. };
  50. return Action;
  51. })();
  52. BABYLON.Action = Action;
  53. })(BABYLON || (BABYLON = {}));
  54. //# sourceMappingURL=babylon.action.js.map