remove World.TileSize constant

This commit is contained in:
Colin McMillen 2020-03-11 11:01:34 -04:00
parent a4802031d5
commit 4346f20024
2 changed files with 2 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;