|
| 1 | +\`\`\`mermaid |
| 2 | +classDiagram |
| 3 | + class PlayerPlugin { |
| 4 | + - FpsControllerPlugin |
| 5 | + - RapierPhysicsPlugin |
| 6 | + - RapierDebugRenderPlugin |
| 7 | + - RapierConfiguration |
| 8 | + - PlayerColliderUpdateEvent |
| 9 | + - Resources |
| 10 | + - Systems |
| 11 | + } |
| 12 | + |
| 13 | + %% Components |
| 14 | + class HighlightCube |
| 15 | + class Player |
| 16 | + class PlayerCamera |
| 17 | + class Raycastable |
| 18 | + |
| 19 | + %% Resources |
| 20 | + class BlockSelection { |
| 21 | + + position: Option<Vec3> |
| 22 | + + normal: Option<Vec3> |
| 23 | + } |
| 24 | + class PlayerSpawned { |
| 25 | + + is_spawned(): bool |
| 26 | + + is_not_spawned(): bool |
| 27 | + } |
| 28 | + class LastPlayerPosition { |
| 29 | + + position: Vec3 |
| 30 | + } |
| 31 | + |
| 32 | + %% Events |
| 33 | + class PlayerColliderUpdateEvent |
| 34 | + |
| 35 | + %% Systems |
| 36 | + class SetupSystems { |
| 37 | + setup_highlight_cube_system |
| 38 | + setup_player_camera |
| 39 | + } |
| 40 | + class UpdateSystems { |
| 41 | + setup_controller_on_area_ready_system |
| 42 | + handle_controller_movement_system |
| 43 | + manage_cursor_system |
| 44 | + handle_mouse_events_system |
| 45 | + handle_keyboard_events_system |
| 46 | + raycast_system |
| 47 | + handle_block_update_events |
| 48 | + broadcast_player_attributes_system |
| 49 | + handle_player_collider_events_system |
| 50 | + } |
| 51 | + |
| 52 | + PlayerPlugin --|> HighlightCube |
| 53 | + PlayerPlugin --|> Player |
| 54 | + PlayerPlugin --|> PlayerCamera |
| 55 | + PlayerPlugin --|> Raycastable |
| 56 | + PlayerPlugin --> BlockSelection |
| 57 | + PlayerPlugin --> PlayerSpawned |
| 58 | + PlayerPlugin --> LastPlayerPosition |
| 59 | + PlayerPlugin --> PlayerColliderUpdateEvent |
| 60 | + PlayerPlugin --> SetupSystems |
| 61 | + PlayerPlugin --> UpdateSystems |
| 62 | +\`\`\` |
| 63 | + |
| 64 | + |
| 65 | +\`\`\`mermaid |
| 66 | +sequenceDiagram |
| 67 | + participant App |
| 68 | + participant PlayerPlugin |
| 69 | + participant Resources |
| 70 | + participant Systems |
| 71 | + participant Physics |
| 72 | + participant Render |
| 73 | + |
| 74 | + note over App,PlayerPlugin: Startup Phase |
| 75 | + App->>PlayerPlugin: Add FpsControllerPlugin |
| 76 | + App->>PlayerPlugin: Add RapierPhysicsPlugin |
| 77 | + App->>PlayerPlugin: Add RapierDebugRenderPlugin |
| 78 | + PlayerPlugin->>Resources: Insert RapierConfiguration |
| 79 | + PlayerPlugin->>Resources: Add BlockSelection, PlayerSpawned, LastPlayerPosition |
| 80 | + PlayerPlugin->>Systems: Add Startup Systems (setup_highlight_cube_system, setup_player_camera) |
| 81 | + |
| 82 | + note over App,PlayerPlugin: Update Phase |
| 83 | + App->>Systems: Run setup_controller_on_area_ready_system |
| 84 | + Systems->>Resources: Check PlayerSpawned, SpawnAreaLoaded |
| 85 | + Systems->>Render: Setup player camera |
| 86 | + Systems->>Physics: Add Player Collider |
| 87 | + |
| 88 | + App->>Systems: Run handle_controller_movement_system |
| 89 | + Systems->>Resources: Update LastPlayerPosition |
| 90 | + Systems->>Events: Trigger PlayerColliderUpdateEvent |
| 91 | + |
| 92 | + App->>Systems: Run raycast_system |
| 93 | + Systems->>Resources: Update BlockSelection |
| 94 | + Systems->>Render: Update HighlightCube Position |
| 95 | + |
| 96 | + App->>Systems: Run handle_mouse_events_system |
| 97 | + Systems->>Resources: Read BlockSelection |
| 98 | + Systems->>Events: Trigger BlockUpdateEvent |
| 99 | + |
| 100 | + App->>Systems: Run handle_block_update_events |
| 101 | + Systems->>Resources: Update Terrain Blocks |
| 102 | + Systems->>Events: Trigger ChunkMeshUpdateEvent |
| 103 | + |
| 104 | + App->>Systems: Run broadcast_player_attributes_system |
| 105 | + Systems->>Resources: Send Player State to Network |
| 106 | + |
| 107 | + App->>Systems: Run handle_player_collider_events_system |
| 108 | + Systems->>Events: Process PlayerColliderUpdateEvent |
| 109 | +\`\`\` |
| 110 | + |
| 111 | +```mermaid |
| 112 | +graph TD |
| 113 | + subgraph PlayerPlugin |
| 114 | + subgraph Components |
| 115 | + HighlightCube |
| 116 | + Player |
| 117 | + PlayerCamera |
| 118 | + Raycastable |
| 119 | + end |
| 120 | +
|
| 121 | + subgraph Resources |
| 122 | + BlockSelection |
| 123 | + PlayerSpawned |
| 124 | + LastPlayerPosition |
| 125 | + end |
| 126 | +
|
| 127 | + subgraph Events |
| 128 | + PlayerColliderUpdateEvent |
| 129 | + end |
| 130 | +
|
| 131 | + subgraph Systems |
| 132 | + setup_highlight_cube_system |
| 133 | + setup_player_camera |
| 134 | + setup_controller_on_area_ready_system |
| 135 | + handle_controller_movement_system |
| 136 | + manage_cursor_system |
| 137 | + handle_mouse_events_system |
| 138 | + handle_keyboard_events_system |
| 139 | + raycast_system |
| 140 | + broadcast_player_attributes_system |
| 141 | + handle_block_update_events |
| 142 | + handle_player_collider_events_system |
| 143 | + end |
| 144 | +
|
| 145 | + subgraph Dependencies |
| 146 | + FpsControllerPlugin |
| 147 | + RapierPhysicsPlugin |
| 148 | + RapierDebugRenderPlugin |
| 149 | + end |
| 150 | +
|
| 151 | + subgraph Conditions |
| 152 | + SpawnAreaLoaded |
| 153 | + PlayerSpawnedConditions |
| 154 | + end |
| 155 | + end |
| 156 | +
|
| 157 | + Dependencies --> PlayerPlugin |
| 158 | + Components --> PlayerPlugin |
| 159 | + Resources --> PlayerPlugin |
| 160 | + Events --> PlayerPlugin |
| 161 | + Systems --> PlayerPlugin |
| 162 | + Conditions --> Systems |
| 163 | +``` |
0 commit comments