public BarracksStateMachine(BarracksInfo.Writer inBarracksInfo, StockpileDepository.Writer inStockpile, Health.Writer inHealth, FlammableBehaviour inFlammableBehaviour, NPCSpawnerBehaviour npcSpawnerBehaviour) { barracksInfo = inBarracksInfo; stockpile = inStockpile; health = inHealth; flammableBehaviour = inFlammableBehaviour; var stateList = new Dictionary <BarracksState, IFsmState> { { BarracksState.UNDER_CONSTRUCTION, new BarracksUnderConstructionState(this, inHealth, npcSpawnerBehaviour) }, { BarracksState.CONSTRUCTION_FINISHED, new BarracksConstructionFinishedState(this, inHealth, npcSpawnerBehaviour) } }; SetStates(stateList); var allowedTransitions = new Dictionary <BarracksState, IList <BarracksState> >() { { BarracksState.UNDER_CONSTRUCTION, new List <BarracksState> { BarracksState.CONSTRUCTION_FINISHED } }, { BarracksState.CONSTRUCTION_FINISHED, new List <BarracksState> { BarracksState.UNDER_CONSTRUCTION } } }; SetTransitions(allowedTransitions); }