AI using ladders

This commit is contained in:
Regalis
2016-01-11 21:31:33 +02:00
parent 17f3ec7301
commit 64e62545a5
7 changed files with 87 additions and 27 deletions
@@ -88,8 +88,8 @@ namespace Barotrauma
Vector2 diff = DiffToCurrentNode();
if (diff == Vector2.Zero) return -host.Steering;
return (diff == Vector2.Zero) ? Vector2.Zero : Vector2.Normalize(diff)*speed;
return Vector2.Normalize(diff) * speed;
}
private Vector2 DiffToCurrentNode()
@@ -107,15 +107,23 @@ namespace Barotrauma
pos -= Submarine.Loaded.SimPosition;
}
if (currentPath.CurrentNode!= null && currentPath.CurrentNode.Ladders!=null)
{
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item && currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
{
currentPath.CurrentNode.Ladders.Item.Pick(character, false, true);
}
if (Math.Sign(host.Steering.Y) == currentPath.CurrentNode.SimPosition.Y - pos.Y)
{
allowedDistance = 0.0f;
}
}
currentPath.CheckProgress(pos, allowedDistance);
if (currentPath.CurrentNode == null) return Vector2.Zero;
//if (currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f && character.AnimController.Stairs == null)
//{
// return currentPath.PrevNode.SimPosition - host.SimPosition;
//}
return currentPath.CurrentNode.SimPosition - pos;
}