- disabling the collider and placing it on the torso when swimming, stunned or dead (todo: attempt to get swimming working with the collider controlling movement)

- only the collider can receive impact damage
- shorter collider to allow crouching in tight spaces
- AI characters are considered close enough to a waypoint if their collider overlaps with it (instead of a distance check)
This commit is contained in:
Regalis
2016-10-14 16:08:55 +03:00
parent 9d9c50a520
commit 1b59d1bc21
8 changed files with 102 additions and 70 deletions
@@ -82,20 +82,20 @@ namespace Barotrauma
Character.AnimController.IgnorePlatforms = true;
}
if (Character.AnimController.Stairs != null)
{
float yDiff = currPath.CurrentNode.WorldPosition.Y - Character.WorldPosition.Y;
//if (Character.AnimController.Stairs != null)
//{
// float yDiff = currPath.CurrentNode.WorldPosition.Y - Character.WorldPosition.Y;
if (Math.Abs(yDiff)>10.0f)
{
int dir = Math.Sign(yDiff);
// if (Math.Abs(yDiff) > 20.0f)
// {
// int dir = Math.Sign(yDiff);
float movement = Character.AnimController.Stairs.StairDirection == Direction.Right ?
dir * Character.AnimController.TargetMovement.Length() : -dir * Character.AnimController.TargetMovement.Length();
// float movement = Character.AnimController.Stairs.StairDirection == Direction.Right ?
// dir * Character.AnimController.TargetMovement.Length() : -dir * Character.AnimController.TargetMovement.Length();
Character.AnimController.TargetMovement = new Vector2(movement, 0.0f);
}
}
// steeringManager.SteeringManual(deltaTime, new Vector2(movement*2, 0.0f));
// }
//}
}
(Character.AnimController as HumanoidAnimController).Crouching = false;
@@ -111,7 +111,7 @@ namespace Barotrauma
if (canOpenDoors && !character.LockHands) CheckDoorsInPath();
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;
//if (currentPath.CurrentNode!=null && currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f) allowedDistance*=0.5f;
Vector2 pos = host.SimPosition;
@@ -139,7 +139,16 @@ namespace Barotrauma
}
}
currentPath.CheckProgress(pos, allowedDistance);
//currentPath.CheckProgress(pos, allowedDistance);
var collider = character.AnimController.GetLimb(LimbType.Collider);
Vector2 colliderBottom = character.AnimController.GetColliderBottom();
if (Math.Abs(collider.SimPosition.X - currentPath.CurrentNode.SimPosition.X) < collider.body.radius*2 &&
currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y &&
currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + collider.body.height + collider.body.radius*2)
{
currentPath.SkipToNextNode();
}
if (currentPath.CurrentNode == null) return Vector2.Zero;
@@ -90,11 +90,12 @@ namespace Barotrauma
escapeObjective.TryComplete(deltaTime);
if (Vector2.Distance(character.SimPosition, enemy.SimPosition) < 3.0f)
{
character.AIController.SteeringManager.SteeringManual(deltaTime, (character.SimPosition - enemy.SimPosition)*0.1f);
coolDownTimer = CoolDown;
}
//if (Vector2.Distance(character.SimPosition, enemy.SimPosition) < 3.0f)
//{
// character.AIController.SteeringManager.SteeringManual(deltaTime,
// new Vector2(Math.Sign(character.SimPosition.X - enemy.SimPosition.X), 0.0f));
// coolDownTimer = CoolDown;
//}
}
public override bool IsCompleted()