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.

MoveManager.cs 2.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using GameClass.GameObj;
  3. using GameEngine;
  4. using Preparation.Utility;
  5. namespace Gaming
  6. {
  7. public partial class Game
  8. {
  9. private readonly MoveManager moveManager;
  10. private class MoveManager
  11. {
  12. // 人物移动
  13. public void MovePlayer(Character playerToMove, int moveTimeInMilliseconds, double moveDirection)
  14. {
  15. moveEngine.MoveObj(playerToMove, moveTimeInMilliseconds, moveDirection);
  16. }
  17. /*
  18. private void ActivateMine(Character player, Mine mine)
  19. {
  20. gameMap.ObjListLock.EnterWriteLock();
  21. try { gameMap.ObjList.Remove(mine); }
  22. catch { }
  23. finally { gameMap.ObjListLock.ExitWriteLock(); }
  24. switch (mine.GetPropType())
  25. {
  26. case PropType.Dirt:
  27. player.AddMoveSpeed(Constant.dirtMoveSpeedDebuff, Constant.buffPropTime);
  28. break;
  29. case PropType.Attenuator:
  30. player.AddAP(Constant.attenuatorAtkDebuff, Constant.buffPropTime);
  31. break;
  32. case PropType.Divider:
  33. player.ChangeCD(Constant.dividerCdDiscount, Constant.buffPropTime);
  34. break;
  35. }
  36. }
  37. */
  38. // private readonly Map gameMap;
  39. private readonly MoveEngine moveEngine;
  40. public MoveManager(Map gameMap)
  41. {
  42. // this.gameMap = gameMap;
  43. this.moveEngine = new MoveEngine(
  44. gameMap: gameMap,
  45. OnCollision: (obj, collisionObj, moveVec) =>
  46. {
  47. //if (collisionObj is Mine)
  48. //{
  49. // ActivateMine((Character)obj, (Mine)collisionObj);
  50. // return MoveEngine.AfterCollision.ContinueCheck;
  51. //}
  52. return MoveEngine.AfterCollision.MoveMax; },
  53. EndMove: obj =>
  54. {
  55. // Debugger.Output(obj, " end move at " + obj.Position.ToString() + " At time: " + Environment.TickCount64);
  56. }
  57. );
  58. }
  59. }
  60. }
  61. }