# mralvaroramirez/unity-tps-charactercombat architecture

> Architecture diagram of the GitHub repository mralvaroramirez/unity-tps-charactercombat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mralvaroramirez/unity-tps-charactercombat
- Repository: https://github.com/mralvaroramirez/unity-tps-charactercombat

## Overview

This repository is a Unity third-person parkour and freeflow-combat controller built around a hierarchical state machine. The player workflow begins with character input and per-frame state updates, then selects movement or combat behavior and applies movement, animation, and combat effects. The README also documents target-group camera feedback and basic enemy AI; their implementation files are absent from the supplied tree, so those capabilities are shown as documented external dependencies. Relationships below are limited to excerpted code, the source index, and README statements.

Main entry points: [`StateMachine/PlayerStateFactory.cs`](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerStateFactory.cs) (State Factory), [`StateMachine/PlayerAttackState.cs`](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerAttackState.cs) (Attack and Combos), [`StateMachine/PlayerGroundedState.cs`](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerGroundedState.cs) (Grounded Movement), [`StateMachine/PlayerStateMachine.cs`](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerStateMachine.cs) (Player Controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["State Machine"]
  node_player["Player Controller"]
  node_state_base["Hierarchical State<br/>[PlayerBaseState.cs]"]
  node_state_factory["State Factory"]
end

subgraph group_movement["Parkour Movement"]
  node_grounded["Grounded Movement"]
  node_run["Walk and Run<br/>[PlayerWalkState.cs]"]
  node_jump["Jump and Fall<br/>[PlayerJumpState.cs]"]
  node_air_boost["Air Boost"]
  node_dash["Dash<br/>[PlayerDashState.cs]"]
  node_climb["Climbing"]
  node_wallrun["Wallrun"]
  node_slide["Slope Sliding"]
  node_idle["Idle<br/>[PlayerIdleState.cs]"]
end

subgraph group_combat["Freeflow Combat"]
  node_attack["Attack and Combos"]
  node_damage["Damage Response"]
  node_skill["Skill State"]
end

subgraph group_integrations["Game Integrations"]
  node_enemy_ai["Enemy AI"]
  node_action_camera["Action Camera"]
  node_visual_feedback["Particles and Animation"]
end

node_player -->|"creates"| node_state_factory
node_player -->|"starts in"| node_grounded
node_state_factory -->|"creates"| node_grounded
node_state_factory -->|"creates"| node_run
node_state_factory -->|"creates"| node_jump
node_state_factory -->|"creates"| node_air_boost
node_state_factory -->|"creates"| node_dash
node_state_factory -->|"creates"| node_climb
node_state_factory -->|"creates"| node_wallrun
node_state_factory -->|"creates"| node_slide
node_state_factory -->|"creates"| node_idle
node_state_factory -->|"creates"| node_attack
node_state_factory -->|"creates"| node_skill
node_state_base -->|"sets current state"| node_player
node_grounded -->|"inherits"| node_state_base
node_jump -->|"inherits"| node_state_base
node_attack -->|"inherits"| node_state_base
node_grounded -->|"selects movement"| node_run
node_grounded -->|"switches to"| node_jump
node_jump -->|"requests fall"| node_state_factory
node_attack -->|"targets enemies"| node_enemy_ai
node_attack -->|"triggers feedback"| node_action_camera
node_damage -->|"triggers feedback"| node_action_camera
node_damage -->|"generates effects"| node_visual_feedback
node_attack -->|"generates effects"| node_visual_feedback
node_player -->|"updates animation"| node_visual_feedback

click node_player "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerStateMachine.cs"
click node_state_base "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerBaseState.cs"
click node_state_factory "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerStateFactory.cs"
click node_grounded "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerGroundedState.cs"
click node_run "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerWalkState.cs"
click node_jump "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerJumpState.cs"
click node_air_boost "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerAirBoostState.cs"
click node_dash "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerDashState.cs"
click node_climb "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerClimbingState.cs"
click node_wallrun "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerWallRunState.cs"
click node_slide "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerSlidingState.cs"
click node_idle "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerIdleState.cs"
click node_attack "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerAttackState.cs"
click node_damage "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerDamageState.cs"
click node_skill "https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerSkillState.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_player,node_state_base,node_state_factory toneBlue
class node_grounded,node_run,node_jump,node_air_boost,node_dash,node_climb,node_wallrun,node_slide,node_idle toneAmber
class node_attack,node_damage,node_skill toneMint
class node_enemy_ai,node_action_camera,node_visual_feedback toneRose
```

## Components

### State Machine

- [Player Controller](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerStateMachine.cs): `StateMachine/PlayerStateMachine.cs`
- [Hierarchical State](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerBaseState.cs): `StateMachine/PlayerBaseState.cs`
- [State Factory](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerStateFactory.cs): `StateMachine/PlayerStateFactory.cs`

### Parkour Movement

- [Grounded Movement](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerGroundedState.cs): `StateMachine/PlayerGroundedState.cs`
- [Walk and Run](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerWalkState.cs): `StateMachine/PlayerWalkState.cs`
- [Jump and Fall](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerJumpState.cs): `StateMachine/PlayerJumpState.cs`
- [Air Boost](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerAirBoostState.cs): `StateMachine/PlayerAirBoostState.cs`
- [Dash](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerDashState.cs): `StateMachine/PlayerDashState.cs`
- [Climbing](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerClimbingState.cs): `StateMachine/PlayerClimbingState.cs`
- [Wallrun](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerWallRunState.cs): `StateMachine/PlayerWallRunState.cs`
- [Slope Sliding](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerSlidingState.cs): `StateMachine/PlayerSlidingState.cs`
- [Idle](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerIdleState.cs): `StateMachine/PlayerIdleState.cs`

### Freeflow Combat

- [Attack and Combos](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerAttackState.cs): `StateMachine/PlayerAttackState.cs`
- [Damage Response](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerDamageState.cs): `StateMachine/PlayerDamageState.cs`
- [Skill State](https://github.com/mralvaroramirez/unity-tps-charactercombat/blob/main/StateMachine/PlayerSkillState.cs): `StateMachine/PlayerSkillState.cs`

### Game Integrations

- **Enemy AI**
- **Action Camera**
- **Particles and Animation**

## Connections

- Player Controller → State Factory: creates (evidence: `StateMachine/PlayerStateMachine.cs`)
- Player Controller → Grounded Movement: starts in (evidence: `StateMachine/PlayerStateMachine.cs`)
- State Factory → Grounded Movement: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Walk and Run: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Jump and Fall: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Air Boost: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Dash: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Climbing: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Wallrun: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Slope Sliding: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Idle: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Attack and Combos: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- State Factory → Skill State: creates (evidence: `StateMachine/PlayerStateFactory.cs`)
- Hierarchical State → Player Controller: sets current state (evidence: `StateMachine/PlayerBaseState.cs`)
- Grounded Movement → Hierarchical State: inherits (evidence: `StateMachine/PlayerGroundedState.cs`)
- Jump and Fall → Hierarchical State: inherits (evidence: `StateMachine/PlayerJumpState.cs`)
- Attack and Combos → Hierarchical State: inherits (evidence: `StateMachine/PlayerAttackState.cs`)
- Grounded Movement → Walk and Run: selects movement (evidence: `StateMachine/PlayerGroundedState.cs`)
- Grounded Movement → Jump and Fall: switches to (evidence: `StateMachine/PlayerGroundedState.cs`)
- Jump and Fall → State Factory: requests fall (evidence: `StateMachine/PlayerJumpState.cs`)
- Attack and Combos → Enemy AI: targets enemies (evidence: `StateMachine/PlayerAttackState.cs`)
- Attack and Combos → Action Camera: triggers feedback (evidence: `StateMachine/PlayerAttackState.cs`)
- Damage Response → Action Camera: triggers feedback (evidence: `StateMachine/PlayerDamageState.cs`)
- Damage Response → Particles and Animation: generates effects (evidence: `StateMachine/PlayerDamageState.cs`)
- Attack and Combos → Particles and Animation: generates effects (evidence: `StateMachine/PlayerAttackState.cs`)
- Player Controller → Particles and Animation: updates animation (evidence: `StateMachine/PlayerStateMachine.cs`)
