diff options
author | Starla Insigna <starla4444@gmail.com> | 2011-11-30 12:57:06 -0500 |
---|---|---|
committer | Starla Insigna <starla4444@gmail.com> | 2011-11-30 12:57:06 -0500 |
commit | 6e96fb2144718722208d22f892716b55548135e1 (patch) | |
tree | 4dd550de787dd370a13039c03969442f54a3a856 /Classes/TutorialMode.m | |
parent | fd58a0cde1bb5473e39e6cb82d28113da84b9ae0 (diff) | |
download | cartcollect-6e96fb2144718722208d22f892716b55548135e1.tar.gz cartcollect-6e96fb2144718722208d22f892716b55548135e1.tar.bz2 cartcollect-6e96fb2144718722208d22f892716b55548135e1.zip |
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
Diffstat (limited to 'Classes/TutorialMode.m')
-rw-r--r-- | Classes/TutorialMode.m | 24 |
1 files changed, 22 insertions, 2 deletions
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 @@ | |||
10 | #import "FallingObject.h" | 10 | #import "FallingObject.h" |
11 | #import "GameModeSelectionLayer.h" | 11 | #import "GameModeSelectionLayer.h" |
12 | #import "SimpleAudioEngine.h" | 12 | #import "SimpleAudioEngine.h" |
13 | #import "ClassicGameMode.h" | ||
13 | 14 | ||
14 | // Item tags: | 15 | // Item tags: |
15 | // 2000 - first dropped item | 16 | // 2000 - first dropped item |
@@ -30,6 +31,26 @@ typedef enum { | |||
30 | 31 | ||
31 | @synthesize currentTutorial; | 32 | @synthesize currentTutorial; |
32 | 33 | ||
34 | static GameModeInfo* info; | ||
35 | |||
36 | + (GameModeInfo*)info | ||
37 | { | ||
38 | if (info == nil) | ||
39 | { | ||
40 | info = [[GameModeInfo alloc] initWithName:@"Tutorial" | ||
41 | location:@"Florence" | ||
42 | numOfStars:0 | ||
43 | imageFilename:[[NSBundle mainBundle] pathForResource:@"florence" ofType:@"png"] | ||
44 | unlocked:YES | ||
45 | unlockCondition:nil | ||
46 | gameClass:[TutorialMode class] | ||
47 | globalHighscoreKey:nil | ||
48 | starsToUnlock:0]; | ||
49 | } | ||
50 | |||
51 | return info; | ||
52 | } | ||
53 | |||
33 | - (id)init | 54 | - (id)init |
34 | { | 55 | { |
35 | self = [super init]; | 56 | self = [super init]; |
@@ -357,8 +378,7 @@ typedef enum { | |||
357 | 378 | ||
358 | [self unschedule:@selector(randomlyAddObject:)]; | 379 | [self unschedule:@selector(randomlyAddObject:)]; |
359 | 380 | ||
360 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 381 | [[ClassicGameMode info] unlock]; |
361 | [defaults setBool:YES forKey:@"hasDoneTutorial"]; | ||
362 | 382 | ||
363 | return; | 383 | return; |
364 | } else { | 384 | } else { |