Functional level generation + moving the submarine

This commit is contained in:
Regalis
2015-06-26 23:05:51 +03:00
parent bda9b31cbe
commit 9237a9efe2
48 changed files with 1629 additions and 750 deletions
@@ -219,9 +219,9 @@ namespace Subsurface
//check if there's a wall between the target and the character
Vector2 rayStart = character.animController.limbs[0].SimPosition;
Vector2 rayEnd = selectedTarget.Position;
Body closestBody = Map.CheckVisibility(rayStart, rayEnd);
Body closestBody = Submarine.CheckVisibility(rayStart, rayEnd);
if (Map.LastPickedFraction == 1.0f || closestBody == null)
if (Submarine.LastPickedFraction == 1.0f || closestBody == null)
{
wallAttackPos = Vector2.Zero;
return;
@@ -230,11 +230,11 @@ namespace Subsurface
Structure wall = closestBody.UserData as Structure;
if (wall == null)
{
wallAttackPos = Map.LastPickedPosition;
wallAttackPos = Submarine.LastPickedPosition;
}
else
{
int sectionIndex = wall.FindSectionIndex(ConvertUnits.ToDisplayUnits(Map.LastPickedPosition));
int sectionIndex = wall.FindSectionIndex(ConvertUnits.ToDisplayUnits(Submarine.LastPickedPosition));
float sectionDamage = wall.SectionDamage(sectionIndex);
for (int i = sectionIndex - 2; i <= sectionIndex + 2; i++)
@@ -377,7 +377,7 @@ namespace Subsurface
Vector2 rayStart = character.animController.limbs[0].SimPosition;
Vector2 rayEnd = target.Position;
Body closestBody = Map.CheckVisibility(rayStart, rayEnd);
Body closestBody = Submarine.CheckVisibility(rayStart, rayEnd);
Structure closestStructure = (closestBody == null) ? null : closestBody.UserData as Structure;
//if (targetCharacter != null)
+5 -5
View File
@@ -32,7 +32,7 @@ namespace Subsurface
{
this.host = host;
wanderAngle = ToolBox.RandomFloat(0.0f, MathHelper.TwoPi);
wanderAngle = ToolBox.RandomFloatLocal(0.0f, MathHelper.TwoPi);
}
public void SteeringSeek(Vector2 target, float speed = 1.0f)
@@ -90,7 +90,7 @@ namespace Subsurface
float angleChange = 1.5f;
wanderAngle += ToolBox.RandomFloat(0.0f, 1.0f) * angleChange - angleChange * 0.5f;
wanderAngle += ToolBox.RandomFloatLocal(0.0f, 1.0f) * angleChange - angleChange * 0.5f;
Vector2 newSteering = circleCenter + displacement;
float steeringSpeed = (newSteering + host.Steering).Length();
@@ -113,7 +113,7 @@ namespace Subsurface
if (rayCastTimer <= 0.0f)
{
rayCastTimer = RayCastInterval;
Body closestBody = Map.CheckVisibility(host.Position, ahead);
Body closestBody = Submarine.CheckVisibility(host.Position, ahead);
if (closestBody == null)
{
avoidSteering = Vector2.Zero;
@@ -124,7 +124,7 @@ namespace Subsurface
Structure closestStructure = closestBody.UserData as Structure;
if (closestStructure!=null)
{
Vector2 obstaclePosition = Map.LastPickedPosition;
Vector2 obstaclePosition = Submarine.LastPickedPosition;
if (closestStructure.IsHorizontal)
{
obstaclePosition.Y = closestStructure.SimPosition.Y;
@@ -134,7 +134,7 @@ namespace Subsurface
obstaclePosition.X = closestStructure.SimPosition.X;
}
avoidSteering = Vector2.Normalize(Map.LastPickedPosition - obstaclePosition);
avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - obstaclePosition);
}
}