XmdsClientVirtual.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using CommonAI.Zone.Formula;
  2. using CommonAI.ZoneClient;
  3. using CommonLang.Log;
  4. namespace XmdsCommon.ZoneClient.XmdsClientVirtual
  5. {
  6. public class XmdsClientVirtual : IVirtualClientUnit
  7. {
  8. protected static Logger mLog = LoggerFactory.GetLogger("XmdsClientVirtual");
  9. protected ZoneUnit mOwner = null;
  10. public virtual void OnInit(ZoneUnit owner)
  11. {
  12. mOwner = owner;
  13. mOwner.OnDoEvent += MOwner_OnDoEvent;
  14. }
  15. protected virtual void MOwner_OnDoEvent(ZoneObject obj, CommonAI.Zone.ObjectEvent e)
  16. {
  17. }
  18. public virtual void OnDispose(ZoneUnit owner)
  19. {
  20. if (mOwner != null)
  21. {
  22. mOwner.OnDoEvent -= MOwner_OnDoEvent;
  23. mOwner = null;
  24. }
  25. }
  26. public virtual bool IsEnemy(ZoneUnit unit)
  27. {
  28. bool ret = false;
  29. ret = this.mOwner.Force != unit.Force ? true : false;
  30. return ret;
  31. }
  32. public virtual bool IsAllies(ZoneUnit unit)
  33. {
  34. bool ret = false;
  35. ret = this.mOwner.Force == unit.Force ? true : false;
  36. return ret;
  37. }
  38. public virtual string GetPlayerUUID()
  39. {
  40. return null;
  41. }
  42. public virtual XmdsClientVirtual GetUnitVirtual(uint ObjID)
  43. {
  44. var unit = mOwner.Parent.GetUnit(ObjID);
  45. if (unit != null)
  46. {
  47. return unit.Virtual as XmdsClientVirtual;
  48. }
  49. return null;
  50. }
  51. }
  52. }