Skip to content

Instantly share code, notes, and snippets.

@thuzhf
Created July 19, 2014 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thuzhf/c66fff54b099187f203c to your computer and use it in GitHub Desktop.
Save thuzhf/c66fff54b099187f203c to your computer and use it in GitHub Desktop.
if (state == State.center_area)
{
if (ballsPm.X < -500)
{
state = (goal == 0 ? State.defense_area : State.attack_area);
}
else if (ballsPm.X > 500)
{
state = (goal == 0 ? State.attack_area : State.defense_area);
}
else
{
xna.Vector3 targetPoint = new xna.Vector3(ballsPm.X, 0, ballsPm.Z);
float targetDirection = StrategyHelper.Helpers.GetAngleDegree(goalPoint - ballsPm) / 180f * (float)Math.PI;
for (int i = 0; i < 5; ++i)
{
if (i == 3)
{
number_act(i, 7, fishes[i].PositionMm, ballsPm, fishes[i], goalPoint);
}
else if (i == 0 || i == 2)
{
//actFast(i, targetPoint, fishes[i].PositionMm, targetDirection);
number_act(i, 8, fishes[i].PositionMm, ballsPm, fishes[i], goalPoint);
}
}
}
}
if (state == State.attack_area)
{
if (Math.Abs(ballsPm.X) < 500)
{
state = State.center_area;
}
else if (Math.Abs(ballsPm.X) > 1700)
{
state = State.opposing_penalty_area;
}
else
{
}
}
if (state == State.opposing_penalty_area)
{
if (Math.Abs(ballsPm.X) < 1700)
{
state = State.attack_area;
}
else
{
}
}
if (state == State.defense_area)
{
if (Math.Abs(ballsPm.X) > 1700)
{
state = State.our_penalty_area;
}
else if (Math.Abs(ballsPm.X) < 500)
{
state = State.center_area;
}
else
{
}
}
if (state == State.our_penalty_area)
{
if (Math.Abs(ballsPm.X) < 1700)
{
state = State.defense_area;
}
else
{
}
}
/*
int i = 3;
xna.Vector3 targetPoint = new xna.Vector3(ballsPm.X, 0, ballsPm.Z);
float targetDirection = StrategyHelper.Helpers.GetAngleDegree(goalPoint - ballsPm) / 180f * (float)Math.PI;
//StrategyHelper.Helpers.Dribble(ref decisions[i], mission.TeamsRef[teamId].Fishes[i], targetPoint, targetDirection, 5, 10, 150, 6, 4, 15, 100, true);
if (dribbleState == 0)
{
if (dist(fishes[i].PositionMm, targetPoint) > epsilon)
{
actFast(i, targetPoint, fishes[i].PositionMm, targetDirection);
}
else
{
dribbleState = 1;
}
}
if (dribbleState == 1)
{
number_act(i, 7, fishes[i].PositionMm, ballsPm, fishes[i], goalPoint);
}
*/
//#region fish4
//i = 3;
//targetPoint = new xna.Vector3(ballsPm.X, 0, ballsPm.Z);
//targetDirection = StrategyHelper.Helpers.GetAngleDegree(goalPoint - ballsPm) / 180f * (float)Math.PI;
//StrategyHelper.Helpers.Dribble(ref decisions[i], mission.TeamsRef[teamId].Fishes[i], targetPoint, targetDirection, 5, 10, 150, 6, 4, 15, 100, true);
//#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment