XmdsInstanceSummonUnit.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using CommonAI.Zone;
  2. using CommonAI.Zone.Instance;
  3. namespace XmdsCommonServer.Plugin.Units
  4. {
  5. /// <summary>
  6. /// 召唤单位,目前召唤单位AI与宠物相同,先继承自宠物.
  7. /// </summary>
  8. public class XmdsInstanceSummonUnit : XmdsInstancePet //InstanceGuard, ViewTrigger.ViewTriggerListener, ISummonedUnit
  9. {
  10. public override bool IntersectObj { get { return false; } }
  11. public XmdsInstanceSummonUnit(InstanceZone zone, UnitInfo info, string name, int force, int level)
  12. : base(zone, info, name, force, level)
  13. {
  14. }
  15. public InstanceUnit BindUnit { get; set; }
  16. protected override void onAdded(bool pointLv)
  17. {
  18. base.onAdded(pointLv);
  19. if(this.Info.SumType == CommonAI.Data.SummonType.attack)
  20. {
  21. base.SetFollowMode(XmdsCommon.Plugin.XmdsPetConifg.XmdsPetFollowMode.ActiveAtk);
  22. }
  23. }
  24. override protected void onUpdate(bool slowRefresh)
  25. {
  26. base.onUpdate(slowRefresh);
  27. if (BindUnit != null)
  28. {
  29. if (X != BindUnit.X || Y != BindUnit.Y)
  30. {
  31. setPos(BindUnit.X, BindUnit.Y, false);
  32. }
  33. }
  34. if ((PassTimeMS >= Info.LifeTimeMS) || (SummonerUnit != null && !SummonerUnit.IsActive))
  35. {
  36. kill(null, false);
  37. }
  38. }
  39. public override void InitSkills(LaunchSkill baseSkill, params LaunchSkill[] skills)
  40. {
  41. if (this.Virtual == null ||
  42. (this.Virtual as XmdsVirtual).IsFinishSkillInit() == false)
  43. {
  44. return;
  45. }
  46. base.InitSkills(baseSkill, skills);
  47. }
  48. // 各种填坑,宠物机制被改的贼特殊,贼恶心
  49. protected override bool IsCanAttack(InstanceUnit unit) { return true; }
  50. public override bool IsPet { get { return false; } }
  51. protected override bool IsPetCanAttack() { return true; }
  52. protected override void followMasterChangeSpeed(float speedChag) { }
  53. protected override bool CheckFollowMaster()
  54. {
  55. if(this.Info.SumType == CommonAI.Data.SummonType.MoveToMaster || this.Info.SumType == CommonAI.Data.SummonType.AwaitMaster)
  56. {
  57. return false;
  58. }
  59. return true;
  60. }
  61. protected override void Disposing()
  62. {
  63. BindUnit = null;
  64. base.Disposing();
  65. }
  66. }
  67. }