invalid range check for ranged characters attacking a building
This commit is contained in:
@@ -165,8 +165,12 @@ public enum CombatManager {
|
|||||||
break;
|
break;
|
||||||
case Building:
|
case Building:
|
||||||
if(attackRange > 15){
|
if(attackRange > 15){
|
||||||
if(attacker.loc.distanceSquared(target.loc) < (attackRange * attackRange))
|
float rangeSquared = attackRange * attackRange;
|
||||||
|
//float distanceSquared = attacker.loc.distanceSquared(target.loc);
|
||||||
|
if(distanceSquared < rangeSquared) {
|
||||||
inRange = true;
|
inRange = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
float locX = target.loc.x - target.getBounds().getHalfExtents().x;
|
||||||
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
float locZ = target.loc.z - target.getBounds().getHalfExtents().y;
|
||||||
|
|||||||
Reference in New Issue
Block a user