extend_map_build.go 821 B

123456789101112131415161718192021222324252627
  1. package data
  2. import (
  3. "f1-game/internal/types"
  4. )
  5. func (p *MapBuildRow) GetCoverOffsetPoints(x, y int32, includeCenter bool) types.Points {
  6. return p.getPoints(x, y, p.CoverOddOffsets, p.CoverEvenOffsets, includeCenter)
  7. }
  8. // 获取影响坐标点
  9. func (p *MapBuildRow) GetAffectOffsetPoints(x, y int32, includeCenter bool) types.Points {
  10. return p.getPoints(x, y, p.AffectOddOffsets, p.AffectEvenOffsets, includeCenter)
  11. }
  12. // 获取影响包围坐标点
  13. func (p *MapBuildRow) GetAffectEdgePoints(x, y int32) types.Points {
  14. return p.getPoints(x, y, p.AffectEdgeOddOffsets, p.AffectEdgeEvenOffsets, false)
  15. }
  16. func (p *MapBuildRow) getPoints(x, y int32, odds, evens types.Points, includeCenter bool) types.Points {
  17. points := GetOffsetPoints(x, y, odds, evens)
  18. if includeCenter {
  19. points.Add(x, y)
  20. }
  21. return points
  22. }