babylon.action.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. module BABYLON {
  2. export class Action {
  3. public _actionManager: ActionManager;
  4. private _nextActiveAction;
  5. private _child;
  6. private _condition: Condition;
  7. constructor(public trigger: number, condition?: Condition) {
  8. this._nextActiveAction = this;
  9. this._condition = condition;
  10. }
  11. // Methods
  12. public _prepare(): void {
  13. }
  14. public _executeCurrent(): void {
  15. if (this._condition) {
  16. if (!this._condition.isValid()) {
  17. return;
  18. }
  19. }
  20. this._nextActiveAction.execute();
  21. if (this._nextActiveAction._child) {
  22. this._nextActiveAction = this._nextActiveAction._child;
  23. } else {
  24. this._nextActiveAction = this;
  25. }
  26. }
  27. public execute(): void {
  28. }
  29. public then(action: Action): Action {
  30. this._child = action;
  31. action._actionManager = this._actionManager;
  32. action._prepare();
  33. return action;
  34. }
  35. public _getTarget(targetType: number, targetName: string): any {
  36. return this._actionManager._getTarget(targetType, targetName);
  37. }
  38. public _getProperty(propertyPath: string): string {
  39. return this._actionManager._getProperty(propertyPath);
  40. }
  41. public _getEffectiveTarget(target: any, propertyPath: string): any {
  42. return this._actionManager._getEffectiveTarget(target, propertyPath);
  43. }
  44. }
  45. }