From 6e96fb2144718722208d22f892716b55548135e1 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Wed, 30 Nov 2011 12:57:06 -0500 Subject: Created a game mode manager There is now one location for information relating to each GameMode instead of several places, so that info can be easily updated and propagated to, for instance, GameModeSelectionLayer. GameModes can also be specified by an info instance each owns. There's also a way to get an ordered list of game modes. The three star game mode unlocking system has also been added. Closes #213 --- Classes/JumpGameMode.m | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'Classes/JumpGameMode.m') diff --git a/Classes/JumpGameMode.m b/Classes/JumpGameMode.m index a5c2b8f..b1c5989 100644 --- a/Classes/JumpGameMode.m +++ b/Classes/JumpGameMode.m @@ -35,6 +35,26 @@ typedef enum { kPointMultiplierObject } FallingObjects; +static GameModeInfo* info; + ++ (GameModeInfo*)info +{ + if (info == nil) + { + info = [[GameModeInfo alloc] initWithName:@"Jump" + location:@"Venice" + numOfStars:3 + imageFilename:[[NSBundle mainBundle] pathForResource:@"venice" ofType:@"png"] + unlocked:NO + unlockCondition:@"Get 2000 points in Collect!" + gameClass:[JumpGameMode class] + globalHighscoreKey:@"Jump" + starsToUnlock:2]; + } + + return info; +} + - (id)init { self = [super init]; @@ -208,7 +228,7 @@ typedef enum { { [self unscheduleAllSelectors]; - [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:@"Jump"]]]; + [[CCDirector sharedDirector] replaceScene:[CCTransitionSlideInT transitionWithDuration:1.5f scene:[GameOverScene sceneWithScore:score gameMode:[JumpGameMode info]]]]; } if (wave) -- cgit 1.4.1