IndoorsSteering works outside now
This commit is contained in:
@@ -12,10 +12,7 @@ namespace Barotrauma
|
||||
const float UpdateObjectiveInterval = 0.5f;
|
||||
|
||||
private AIObjectiveManager objectiveManager;
|
||||
|
||||
private IndoorsSteeringManager indoorsSteeringManager;
|
||||
private SteeringManager outdoorsSteeringManager;
|
||||
|
||||
|
||||
private AITarget selectedAiTarget;
|
||||
|
||||
private float updateObjectiveTimer;
|
||||
@@ -34,8 +31,7 @@ namespace Barotrauma
|
||||
|
||||
public HumanAIController(Character c) : base(c)
|
||||
{
|
||||
indoorsSteeringManager = new IndoorsSteeringManager(this, true);
|
||||
outdoorsSteeringManager = new SteeringManager(this);
|
||||
steeringManager = new IndoorsSteeringManager(this, true);
|
||||
|
||||
objectiveManager = new AIObjectiveManager(c);
|
||||
objectiveManager.AddObjective(new AIObjectiveFindSafety(c));
|
||||
@@ -48,7 +44,7 @@ namespace Barotrauma
|
||||
{
|
||||
Character.ClearInputs();
|
||||
|
||||
steeringManager = Character.AnimController.CurrentHull == null ? outdoorsSteeringManager : indoorsSteeringManager;
|
||||
//steeringManager = Character.AnimController.CurrentHull == null ? outdoorsSteeringManager : indoorsSteeringManager;
|
||||
|
||||
if (updateObjectiveTimer>0.0f)
|
||||
{
|
||||
|
||||
@@ -21,5 +21,7 @@ namespace Barotrauma
|
||||
get;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,13 @@ namespace Barotrauma
|
||||
if (findPathTimer > 0.0f) return Vector2.Zero;
|
||||
|
||||
currentTarget = target;
|
||||
currentPath = pathFinder.FindPath(host.SimPosition, target);
|
||||
Vector2 pos = host.SimPosition;
|
||||
if (character!=null && character.Submarine==null)
|
||||
{
|
||||
pos -= Submarine.Loaded.SimPosition;
|
||||
}
|
||||
|
||||
currentPath = pathFinder.FindPath(pos, target);
|
||||
|
||||
findPathTimer = Rand.Range(1.0f,1.2f);
|
||||
|
||||
@@ -95,7 +101,13 @@ namespace Barotrauma
|
||||
float allowedDistance = character.AnimController.InWater ? 1.0f : 0.6f;
|
||||
if (currentPath.CurrentNode!=null && currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f) allowedDistance*=0.5f;
|
||||
|
||||
currentPath.CheckProgress(host.SimPosition, allowedDistance);
|
||||
Vector2 pos = host.SimPosition;
|
||||
if (character != null && character.Submarine == null)
|
||||
{
|
||||
pos -= Submarine.Loaded.SimPosition;
|
||||
}
|
||||
|
||||
currentPath.CheckProgress(pos, allowedDistance);
|
||||
|
||||
if (currentPath.CurrentNode == null) return Vector2.Zero;
|
||||
|
||||
@@ -104,7 +116,7 @@ namespace Barotrauma
|
||||
// return currentPath.PrevNode.SimPosition - host.SimPosition;
|
||||
//}
|
||||
|
||||
return currentPath.CurrentNode.SimPosition - host.SimPosition;
|
||||
return currentPath.CurrentNode.SimPosition - pos;
|
||||
}
|
||||
|
||||
private void CheckDoorsInPath()
|
||||
|
||||
@@ -76,7 +76,11 @@ namespace Barotrauma
|
||||
//if character is outside the sub and target isn't, transform the position
|
||||
if (character.Submarine == null && target.Submarine != null)
|
||||
{
|
||||
currTargetPos += target.Submarine.SimPosition;
|
||||
//currTargetPos += target.Submarine.SimPosition;
|
||||
}
|
||||
else if (target.Submarine==null)
|
||||
{
|
||||
currTargetPos -= Submarine.Loaded.SimPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,10 +103,10 @@ namespace Barotrauma
|
||||
Vector2 nodePos = node.Position;
|
||||
|
||||
//if node waypoint is one of submarine waypoints outside the sub, transform position
|
||||
if (node.Waypoint != null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull == null)
|
||||
{
|
||||
nodePos -= node.Waypoint.Submarine.Position;
|
||||
}
|
||||
//if (node.Waypoint != null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull == null)
|
||||
//{
|
||||
// nodePos -= node.Waypoint.Submarine.Position;
|
||||
//}
|
||||
|
||||
float dist = System.Math.Abs(start.X-nodePos.X)+
|
||||
System.Math.Abs(start.Y - nodePos.Y)*10.0f +
|
||||
@@ -135,10 +135,10 @@ namespace Barotrauma
|
||||
Vector2 nodePos = node.Position;
|
||||
|
||||
//if node waypoint is one of submarine waypoints outside the sub, transform position
|
||||
if (node.Waypoint!=null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull==null)
|
||||
{
|
||||
nodePos -= node.Waypoint.Submarine.Position;
|
||||
}
|
||||
//if (node.Waypoint!=null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull==null)
|
||||
//{
|
||||
// nodePos -= node.Waypoint.Submarine.Position;
|
||||
//}
|
||||
|
||||
float dist = Vector2.Distance(end, nodePos);
|
||||
if (dist < closestDist || endNode == null)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user