You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 line
1.1 KiB

  1. -- 定义动画状态机
  2. AnimEntityStatus =
  3. {
  4. [1] =
  5. {
  6. stateName = "death",
  7. stateValues =
  8. {
  9. [1] = {animation = "death" , loop = false , staticWhenEnd = true};
  10. };
  11. };
  12. [2] =
  13. {
  14. stateName = "skill",
  15. stateValues =
  16. {
  17. [1] = {animation = "spell" , loop = false};
  18. [2] = {animation = "spell2" , loop = false};
  19. };
  20. };
  21. [3] =
  22. {
  23. stateName = "attack",
  24. stateValues =
  25. {
  26. [1] = {animation = "attack" , loop = false};
  27. };
  28. };
  29. [4] =
  30. {
  31. stateName = "move",
  32. stateValues =
  33. {
  34. [0] = {animation = "stand" , loop = true , randomPosition = true};
  35. [1] = {animation = "walk" , loop = true , randomPosition = true};
  36. [2] = {animation = "walk2" , loop = true , randomPosition = true};
  37. };
  38. }
  39. }
  40. cc.AnimEntityUtils:getInstance():setAnimGroupSet(AnimEntityStatus)
  41. -- 创建英雄动画实例
  42. function createHeroEntity(skeleton)
  43. if type(skeleton.createAnimEntity) == "function" then
  44. skeleton:createAnimEntity()
  45. local animEntity = skeleton:getAnimEntity();
  46. -- 默认播放站立动画
  47. animEntity:updateState("move", 0);
  48. return animEntity
  49. end
  50. return nil
  51. end