コード例 #1
0
ファイル: Board.cs プロジェクト: TotKtoNado/TotKtoNada
 bool IAgentFunctions.askStep(Coordinates direction, float speedPercent, ref AgentEnv client)
 {
     //Try to make step in specific direction. The length = max(speedPercent,1) * maxSpeed
     Coordinates pos = client.getCoord(), des;
     float perc = Math.Min(Math.Max(0.0f, speedPercent), 1.0f);
     des = pos + (direction.normalize()) * (perc * client.getSpeed());
     if (isPathLegal(pos, des))
     {
         client.setCoord(des);
         return true;
     }
     else
     {
         return false;
     }
 }