Roboman.js 789 B

12345678910111213141516171819202122232425262728293031323334
  1. 'atomic component';
  2. exports.component = function(self) {
  3. var node = self.node;
  4. var animationController = node.getComponent("AnimationController");
  5. animationController.playExclusive("Idle", 0, true);
  6. self.subscribeToEvent("PlayRun", function() {
  7. animationController.playExclusive("Run", 0, true);
  8. });
  9. self.subscribeToEvent("PlayIdle", function() {
  10. animationController.playExclusive("Idle", 0, true);
  11. });
  12. self.subscribeToEvent("PlayAttack", function() {
  13. animationController.playExclusive("Attack", 0, true);
  14. });
  15. self.subscribeToEvent("PlayWalk", function() {
  16. animationController.playExclusive("Walk", 0, true);
  17. });
  18. self.update = function(timeStep) {
  19. node.yaw(timeStep * 10);
  20. }
  21. }