Functional level generation + moving the submarine
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -769,13 +769,13 @@ namespace Subsurface
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Particle p = Game1.particleManager.CreateParticle("waterblood",
|
||||
torso.SimPosition + new Vector2(ToolBox.RandomFloat(-0.5f, 0.5f), ToolBox.RandomFloat(-0.5f, 0.5f)),
|
||||
torso.SimPosition + new Vector2(ToolBox.RandomFloatLocal(-0.5f, 0.5f), ToolBox.RandomFloatLocal(-0.5f, 0.5f)),
|
||||
Vector2.Zero);
|
||||
if (p!=null) p.Size *= 2.0f;
|
||||
|
||||
Game1.particleManager.CreateParticle("bubbles",
|
||||
torso.SimPosition,
|
||||
new Vector2(ToolBox.RandomFloat(-0.5f, 0.5f), ToolBox.RandomFloat(-1.0f,0.5f)));
|
||||
new Vector2(ToolBox.RandomFloatLocal(-0.5f, 0.5f), ToolBox.RandomFloatLocal(-1.0f,0.5f)));
|
||||
}
|
||||
|
||||
foreach (var joint in animController.limbJoints)
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace Subsurface
|
||||
|
||||
Game1.particleManager.CreateParticle("blood",
|
||||
SimPosition,
|
||||
particleVel * ToolBox.RandomFloat(1.0f, 3.0f));
|
||||
particleVel * ToolBox.RandomFloatLocal(1.0f, 3.0f));
|
||||
}
|
||||
|
||||
for (int i = 0; i < bloodAmount / 2; i++)
|
||||
|
||||
@@ -462,7 +462,7 @@ namespace Subsurface
|
||||
//limb isn't in any room -> it's in the water
|
||||
limb.inWater = true;
|
||||
}
|
||||
else if (limbHull.Volume>0.0f && Map.RectContains(limbHull.Rect, limbPosition))
|
||||
else if (limbHull.Volume>0.0f && Submarine.RectContains(limbHull.Rect, limbPosition))
|
||||
{
|
||||
|
||||
if (limbPosition.Y < limbHull.Surface)
|
||||
|
||||
Reference in New Issue
Block a user