Okay so, I came across a nice little fix for my menu and start game problem in my coding. The problem is that I got errors coming from every orifice mostly the top half. This is the template I had:
http://gamedevelopment.tutsplus.com/articles/how-to-build-a-jrpg-a-primer-for-game-developers--gamedev-6676
And Unity was loving it for the first few bits. Any tips would help and other than the StateMachine I got it all word for word.
class StateMachine {
Map mStates = new Map();
IState mCurrentState = EmptyState;
StateMachine gGameMode = new StateMachine();
gGameMode.Add("mainmenu", new MainMenuState(gGameMode));
gGameMode.Add("openingscrean", new OpeningScreanState(gGameMode));
gGameMode.Add("localmap", new LocalMap(gGameMode));
gGameMode.Change("openingscrean");
public void Update(float elapsedTime) {
mCurrentState.Update(elapsedTime);
}
public void Update() {
float elapsedTime = GetElapsedFrameTime();
gGameMode.Update(elapsedTime);
gGameMode.Render();
}
public void Render() {
mCurrentState.Render();
}
public void Change(String stateName) {
mCurrentState.OnExit();
mCurrentState = mStates[stateName];
mCurrentState.OnEnter();
}
public void Add(String name, IState state) {
mStates[name] = state;
}
}
↧