SkillManager.ts 802 B

123456789101112131415161718192021222324252627282930313233
  1. import { _decorator, Component, Node } from 'cc';
  2. import DefaultSkill from './DefaultSkill';
  3. import { KillAllMonsterSkill } from './KillAllMonsterSkill';
  4. import { SkillBase } from './SkillBase';
  5. const { ccclass, property } = _decorator;
  6. export default class SkillManager{
  7. constructor(){
  8. }
  9. /**
  10. * 创建技能
  11. * @param type
  12. */
  13. public Create(skillID:number):SkillBase{
  14. switch (skillID) {
  15. case 40001:
  16. return new KillAllMonsterSkill();
  17. default:
  18. return new DefaultSkill();
  19. }
  20. }
  21. private static instance:SkillManager;
  22. public static get single():SkillManager{
  23. if(this.instance==null){
  24. this.instance=new SkillManager();
  25. }
  26. return this.instance;
  27. }
  28. }