A modular and extensible framework for building turn-based games in Unity, featuring a clean state-driven architecture, intuitive input handling, and built-in support for Dependency Injection via Zenject.
- 🔁 Turn-based round controller
- 🧠 AI and player turn state system
- 💡 State-driven design using abstract classes/interfaces
- 🧩 Plug-and-play architecture with Zenject support
- 🎯 Great for tactical RPGs, board games, or mini-games
- Clone or download the repository
- Import the scripts into your Unity project
- Set up the game objects and turn manager prefab
- (Optional) Add a Zenject
SceneContext
and bind your dependencies
Create a custom player state:
public class PlayerTurnState : TurnState
{
public override void Enter()
{
Debug.Log("Player's Turn Begins!");
// Handle player input here
}
public override void Exit()
{
Debug.Log("Player's Turn Ends.");
}
}
Use the turn manager to transition:
_turnManager.SetState(new PlayerTurnState());
TurnBaseToolkit/
├── TurnManager.cs
├── TurnState.cs
├── PlayerTurnState.cs
├── EnemyTurnState.cs
├── TurnContext.cs
└── Installer.cs (for Zenject)
If you're using Zenject:
public class GameInstaller : MonoInstaller
{
public override void InstallBindings()
{
Container.Bind<TurnManager>().AsSingle();
Container.Bind<ITurnState>().To<PlayerTurnState>().AsTransient();
}
}
- Tactical RPGs (e.g., Fire Emblem style)
- Board games and chess-like logic
- Puzzle games with enemy phases
Coming soon!
MIT © Dean Aviv