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.

BirthPoint.cs 1.0 kB

1234567891011121314151617181920212223242526272829
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. using Preparation.GameData;
  4. namespace GameClass.GameObj
  5. {
  6. /// <summary>
  7. /// 出生点
  8. /// </summary>
  9. public class BirthPoint : ObjOfCharacter
  10. {
  11. public BirthPoint(XY initPos) :
  12. base(initPos, GameData.numOfPosGridPerCell / 2, PlaceType.Land, GameObjType.BirthPoint)
  13. {
  14. this.CanMove = false;
  15. }
  16. // 修改建议:需要避免非自己的玩家进入出生点,否则会重叠
  17. public override bool IsRigid => true;
  18. protected override bool IgnoreCollideExecutor(IGameObj targetObj)
  19. {
  20. if (targetObj.Type != GameObjType.Character)
  21. return true; // 非玩家不碰撞
  22. else if (targetObj.Type == GameObjType.Character && targetObj.ID == this.Parent.ID)
  23. return true; // 出生点所属的玩家不碰撞
  24. return false;
  25. }
  26. public override ShapeType Shape => ShapeType.Square;
  27. }
  28. }