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

Character.SkillManager.cs 1.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Preparation.Utility;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace GameClass.GameObj
  5. {
  6. public partial class Character
  7. {
  8. private delegate bool CharacterActiveSkill(Character player); // 返回值:是否成功释放了技能
  9. private delegate void CharacterPassiveSkill(Character player);
  10. private readonly CharacterActiveSkill commonSkill;
  11. private readonly ActiveSkillType commonSkillType;
  12. public ActiveSkillType CommonSkillType => commonSkillType;
  13. private readonly CharacterType passiveSkillType;
  14. public CharacterType PassiveSkillType => passiveSkillType;
  15. public bool UseCommonSkill()
  16. {
  17. return commonSkill(this);
  18. }
  19. private int timeUntilCommonSkillAvailable = 0; // 还剩多少时间可以使用普通技能
  20. public int TimeUntilCommonSkillAvailable
  21. {
  22. get => timeUntilCommonSkillAvailable;
  23. set {
  24. lock (gameObjLock)
  25. timeUntilCommonSkillAvailable = value < 0 ? 0 : value;
  26. }
  27. }
  28. readonly CharacterPassiveSkill passiveSkill;
  29. public void UsePassiveSkill()
  30. {
  31. passiveSkill(this);
  32. return;
  33. }
  34. public Character(XY initPos, int initRadius, PlaceType initPlace, CharacterType passiveSkillType, ActiveSkillType commonSkillType) :
  35. base(initPos, initRadius, initPlace, GameObjType.Character)
  36. {
  37. this.CanMove = true;
  38. this.score = 0;
  39. this.propInventory = null;
  40. this.buffManeger = new BuffManeger();
  41. // UsePassiveSkill(); //创建player时开始被动技能,这一过程也可以放到gamestart时进行
  42. // 这可以放在AddPlayer中做
  43. Debugger.Output(this, "constructed!");
  44. }
  45. }
  46. }