Browse Source

remove World.TileSize constant

master
Colin McMillen 4 years ago
parent
commit
4346f20024
  1. 5
      Shared/LinesOfSight.cs
  2. 2
      Shared/World.cs

5
Shared/LinesOfSight.cs

@ -68,13 +68,12 @@ namespace SemiColinGames {
Vector2 closestHit = Vector2.Add(eyePos, rotated);
float hitTime = 1f;
Vector2 halfTileSize = new Vector2(World.TileSize / 2.0f, World.TileSize / 2.0f);
for (int j = 0; j < collisionTargets.Length; j++) {
AABB box = collisionTargets[j];
if (Math.Abs(box.Position.X - npc.Position.X) > visionRange + halfTileSize.X) {
if (Math.Abs(box.Position.X - npc.Position.X) > visionRange + box.HalfSize.X) {
continue;
}
Vector2 delta = Vector2.Add(halfTileSize, Vector2.Subtract(box.Position, eyePos));
Vector2 delta = Vector2.Add(box.HalfSize, Vector2.Subtract(box.Position, eyePos));
if (delta.LengthSquared() > visionRangeSq) {
continue;
}

2
Shared/World.cs

@ -8,8 +8,6 @@ namespace SemiColinGames {
public sealed class World : IDisposable {
public const int TileSize = 16;
// Size of World in terms of tile grid.
private int gridWidth;
private int gridHeight;

Loading…
Cancel
Save