Fixed compilation issues

Many features broken while redesigning state system.
Modified StateManager and IAppState

(WIP - it is compiling)