| 176 | // |
| 177 | |
| 178 | class TestCameraMove : public TestSequence { |
| 179 | public: |
| 180 | Point2DI camera_pos_; |
| 181 | |
| 182 | void OnTestStart() override { |
| 183 | ActionFeatureLayerInterface* action = agent_->ActionsFeatureLayer(); |
| 184 | |
| 185 | const GameInfo& game_info = agent_->Observation()->GetGameInfo(); |
| 186 | |
| 187 | const float kRandomOffset = 10.0f; |
| 188 | |
| 189 | Point2D test_point = FindCenterOfMap(game_info); |
| 190 | test_point.x += GetRandomScalar() * kRandomOffset; |
| 191 | test_point.y += GetRandomScalar() * kRandomOffset; |
| 192 | |
| 193 | camera_pos_ = ConvertWorldToMinimap(game_info, test_point); |
| 194 | action->CameraMove(camera_pos_); |
| 195 | |
| 196 | wait_game_loops_ = 5; |
| 197 | } |
| 198 | |
| 199 | void OnStep() override { |
| 200 | |
| 201 | } |
| 202 | |
| 203 | void OnTestFinish() override { |
| 204 | const GameInfo& game_info = agent_->Observation()->GetGameInfo(); |
| 205 | Point2D camera_world = agent_->Observation()->GetCameraPos(); |
| 206 | Point2DI camera = ConvertWorldToMinimap(game_info, camera_world); |
| 207 | |
| 208 | if (camera.x != camera_pos_.x || camera.y != camera_pos_.y) { |
| 209 | ReportError("Camera not at expected location"); |
| 210 | } |
| 211 | } |
| 212 | }; |
| 213 | |
| 214 | class UnitCommandsFeatureLayer : public TestSequence { |
| 215 | public: |
no outgoing calls