| 299 | } |
| 300 | |
| 301 | public static void AgentLoop( |
| 302 | ReducerContext ctx, |
| 303 | GameEnemyAiAgentState agent, |
| 304 | GameTargetableState agent_targetable, |
| 305 | List<GameTargetableState> surrounding_agents, |
| 306 | ulong current_time_ms |
| 307 | ) |
| 308 | { |
| 309 | ulong entity_id = agent.entity_id; |
| 310 | |
| 311 | GameMobileEntityState? coordinates = |
| 312 | ctx.Db.game_mobile_entity_state.entity_id.Find(entity_id) |
| 313 | ?? throw new Exception("GameMobileEntityState Entity ID not found"); |
| 314 | |
| 315 | GameEnemyState agent_entity = |
| 316 | ctx.Db.game_enemy_state.entity_id.Find(entity_id) |
| 317 | ?? throw new Exception("GameEnemyState Entity ID not found"); |
| 318 | |
| 319 | GameHerdCache agent_herd = |
| 320 | ctx.Db.game_herd_cache.id.Find(agent_entity.herd_id) |
| 321 | ?? throw new Exception("GameHerdCache Entity ID not found"); |
| 322 | |
| 323 | SmallHexTile agent_herd_coordinates = agent_herd.location; |
| 324 | |
| 325 | MoveAgent(ctx, ref agent, agent_herd_coordinates, current_time_ms); |
| 326 | } |
| 327 | |
| 328 | [SpacetimeDB.Reducer] |
| 329 | public static void game_loop_enemy_ia(ReducerContext ctx, ulong players) |