public Position ExecuteStep(ActionData data) { var p = GetDefaultParameters(); ActionManager.MergeParameters(p, data.ActionParameters); int timeDiff = Convert.ToInt32(p["timeDiff"]); int minTime = Convert.ToInt32(p["minTime"]); int relDepRow = Convert.ToInt32(p["dependantRelativeRow"]); int relDepCol = Convert.ToInt32(p["depandantRelativeColumn"]); int dependant = Convert.ToInt32(p["dependant"]); if (relDepRow != 0 || relDepCol != 0) { dependant = (data.GetFormation() as RowsFormation).GetRelativePosition(data.CurrentPlayer, relDepRow, relDepCol); } if (data.LocalTime - timeDiff < minTime) { return(data.GetCurrentPosition()); } var dc = data.GetPosition(dependant, data.LocalTime - timeDiff); var dlast = data.GetPosition(dependant, data.LocalTime - timeDiff - 1); var pc = data.GetCurrentPosition(); return(new Position( pc.X + dc.X - dlast.X, pc.Y + dc.Y - dlast.Y, pc.Rotation + dc.Rotation - dlast.Rotation)); }
public Position ExecuteStep(ActionData data) { var p = GetDefaultParameters(); ActionManager.MergeParameters(p, data.ActionParameters); double stepsize = Convert.ToDouble(p["stepsize"]); double direction = Convert.ToDouble(p["direction"]); return(PositionHelper.Forward(data.GetCurrentPosition(), stepsize, direction)); }
public Position ExecuteStep(ActionData data) { var p = GetDefaultParameters(); ActionManager.MergeParameters(p, data.ActionParameters); double rotation = Convert.ToDouble(p["rotation"]); var pos = data.GetCurrentPosition(); pos.Rotation -= rotation; return(pos); }
public Position ExecuteStep(ActionData data) { var p = GetDefaultParameters(); ActionManager.MergeParameters(p, data.ActionParameters); double depth = Convert.ToDouble(p["depth"]); double stepsize = Convert.ToDouble(p["stepsize"]); int relDepRow = Convert.ToInt32(p["dependantRelativeRow"]); int relDepCol = Convert.ToInt32(p["depandantRelativeColumn"]); int dependant = Convert.ToInt32(p["dependant"]); if (relDepRow != 0 || relDepCol != 0) { dependant = (data.GetFormation() as RowsFormation).GetRelativePosition(data.CurrentPlayer, relDepRow, relDepCol); } Position depPos = data.GetPosition(dependant, data.LocalTime); double alpha = data.GetCurrentPosition().Rotation - PositionHelper.ToDegrees( Math.Atan((depPos.Y - data.GetCurrentPosition().Y) / (depPos.X - data.GetCurrentPosition().X))); double hyp = PositionHelper.GetDistance(data.GetCurrentPosition(), depPos); double x = Math.Abs(hyp * Math.Cos(PositionHelper.ToRadians(alpha))) - depth; if (x <= stepsize) { return(PositionHelper.Forward(data.GetCurrentPosition(), x)); } return(PositionHelper.Forward(data.GetCurrentPosition(), stepsize)); }
public Position ExecuteStep(ActionData data) { return(data.GetCurrentPosition()); }