public PlayerBase(SoccerTeam homeTeam, int homeRegionIndex, Vector2D heading, Vector2D velocity,
double mass, double maxForce, double maxSpeed, double maxTurnRate, double scale, PlayerRoles role)
: base(homeTeam.Pitch.GetRegion(homeRegionIndex).VectorCenter, scale * 10.0, velocity, maxSpeed, heading, mass, new Vector2D(scale, scale), maxTurnRate, maxForce)
{
_playerRole = role;
_team = homeTeam;
_distanceToBallSquared = double.MaxValue;
_homeRegionIndex = homeRegionIndex;
_kickoffRegionIndex = homeRegionIndex;
Vector2D[] player = new Vector2D[4] { new Vector2D(-3, 8), new Vector2D(3, 10), new Vector2D(3, -10), new Vector2D(-3, -8) };
for (int vertexIndex = 0; vertexIndex < 4; vertexIndex++)
{
_vecPlayerVB.Add(player[vertexIndex]);
//set the bounding radius to the length of the
//greatest extent
if (Math.Abs(player[vertexIndex].X) > BoundingRadius)
{
BoundingRadius = Math.Abs(player[vertexIndex].X);
}
if (Math.Abs(player[vertexIndex].Y) > BoundingRadius)
{
BoundingRadius = Math.Abs(player[vertexIndex].Y);
}
}
//set up the steering behavior class
_steeringBehaviors = new SteeringBehaviors(this, Ball);
//a player's start target is its start position (because it's just waiting)
_steeringBehaviors.Target = _team.Pitch.GetRegion(_homeRegionIndex).VectorCenter;
AutoList<PlayerBase>.GetAllMembers().Add(this);
_defaultHomeRegionIndex = _homeRegionIndex;
}