remove World.TileSize constant
This commit is contained in:
parent
a4802031d5
commit
4346f20024
@ -68,13 +68,12 @@ namespace SemiColinGames {
|
|||||||
Vector2 closestHit = Vector2.Add(eyePos, rotated);
|
Vector2 closestHit = Vector2.Add(eyePos, rotated);
|
||||||
float hitTime = 1f;
|
float hitTime = 1f;
|
||||||
|
|
||||||
Vector2 halfTileSize = new Vector2(World.TileSize / 2.0f, World.TileSize / 2.0f);
|
|
||||||
for (int j = 0; j < collisionTargets.Length; j++) {
|
for (int j = 0; j < collisionTargets.Length; j++) {
|
||||||
AABB box = collisionTargets[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;
|
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) {
|
if (delta.LengthSquared() > visionRangeSq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@ namespace SemiColinGames {
|
|||||||
|
|
||||||
public sealed class World : IDisposable {
|
public sealed class World : IDisposable {
|
||||||
|
|
||||||
public const int TileSize = 16;
|
|
||||||
|
|
||||||
// Size of World in terms of tile grid.
|
// Size of World in terms of tile grid.
|
||||||
private int gridWidth;
|
private int gridWidth;
|
||||||
private int gridHeight;
|
private int gridHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user