Advertisement
Guest User

Chunk

a guest
Jun 17th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @class Chunk;
  2.  
  3. @protocol ChunkDelegate
  4. @required
  5. - (CGFloat)heightForChunk:(Chunk *)chunk;
  6. @end
  7.  
  8. @interface ChunkController ()<ChunkDelegate>
  9.  
  10. @property (nonatomic, strong) Game *game;
  11.  
  12. @end
  13.  
  14. @implementation ChunkController
  15.  
  16. - (void)createChunks;
  17. {
  18.   // create chunks here
  19.   Chunk *chunk = [[Chunk alloc] initWithDelegate:self]
  20. }
  21.  
  22. - (CGFloat)heightForChunk:(Chunk *)chunk;
  23. {
  24.   // calculate height for the chunk here
  25. }
  26.  
  27. @end
  28.  
  29. @interface Chunk
  30.  
  31. @property (nonatomic, weak) id<ChunkDelegate> delegate;
  32.  
  33. - (instancetype)initWithDelegate:(id<ChunkDelegate>)delegate;
  34.  
  35. @end
  36.  
  37. @implementation Chunk
  38.  
  39. - (instancetype)initWithDelegate:(id<ChunkDelegate>)delegate;
  40. {
  41.     self = [super init];
  42.     if (self) {
  43.         self.delegate = delegate;
  44.     }
  45.     return self;
  46. }
  47.  
  48. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement