Hi
I have searched for some time now, to find some sample or discussions about how to handle a problem I’m facing right now. A pretty basic and common problem I would say
Let’s say I have a scene called Level. This scene were all the 100+ individual levels of my game runs. The way I load in different levels etc. isn’t really interesting here, let’s just say I have that part in place.
My problem is that I have a hard time figuring out how to handle all the transitions and states of a level in a simple and maintainable way.
If you think about a game like Candy Crush for instance, their “level” goes like this:
- Show of a background
- The gameboard slides in
- A lille guy comes down from the top, telling you a brief description of what this particual level is about.
- You touch the guy and he goes away away, in an smooth animation moving up
- Game runs
- You might die and a new thing slides down from the top.
- etc.
And all of these things are happening over time, which is kind of the problem.
I have a “working solution” now, the game works, but it’s way to complicated codewise, and way to hard to figure out - which isn’t what I want. I want something more clean.
I am doing something like this, which you can see becomes impossible to overcome very quickly.
So my question is really, how to you guys handle this. Can you point to a resource with a good sample or anything else?
NGUITools.SetActive (PrePlayPanel.gameObject, true);
PrePlayTween.PlayForward ();
Invoke ("BeginStartLevel", 10.0f);
public void BeginStartLevel()
{
if(State == LevelStates.PrePlaying)
{
EventDelegate.Add (PrePlayTween.onFinished, StartLevel);
PrePlayTween.PlayReverse ();
}
}
private void StartLevel()
{
EventDelegate.Remove (PrePlayTween.onFinished, StartLevel);
NGUITools.SetActive (PrePlayPanel.gameObject, false);
State = LevelStates.Playing;
_currentGameManager.StartLevel ();
}