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/TutorialMode.m | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'Classes/TutorialMode.m') diff --git a/Classes/TutorialMode.m b/Classes/TutorialMode.m index 156b939..54f4e16 100644 --- a/Classes/TutorialMode.m +++ b/Classes/TutorialMode.m @@ -10,6 +10,7 @@ #import "FallingObject.h" #import "GameModeSelectionLayer.h" #import "SimpleAudioEngine.h" +#import "ClassicGameMode.h" // Item tags: // 2000 - first dropped item @@ -30,6 +31,26 @@ typedef enum { @synthesize currentTutorial; +static GameModeInfo* info; + ++ (GameModeInfo*)info +{ + if (info == nil) + { + info = [[GameModeInfo alloc] initWithName:@"Tutorial" + location:@"Florence" + numOfStars:0 + imageFilename:[[NSBundle mainBundle] pathForResource:@"florence" ofType:@"png"] + unlocked:YES + unlockCondition:nil + gameClass:[TutorialMode class] + globalHighscoreKey:nil + starsToUnlock:0]; + } + + return info; +} + - (id)init { self = [super init]; @@ -357,8 +378,7 @@ typedef enum { [self unschedule:@selector(randomlyAddObject:)]; - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - [defaults setBool:YES forKey:@"hasDoneTutorial"]; + [[ClassicGameMode info] unlock]; return; } else { -- cgit 1.4.1