-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorldModel.h
More file actions
61 lines (46 loc) · 1.63 KB
/
WorldModel.h
File metadata and controls
61 lines (46 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// WorldModel.h
// Doors
//
// Created by Mathias Kegelmann on 10/7/09.
// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "DoorsDirections.h"
#import "DoorLocator.h"
@class WorldModel;
// I contain a list of DoorLocators of the doors I toggle
@interface DoorKnob : NSObject {
WorldModel *worldModel;
NSArray *doorLocators;
}
- (id)initWithWorldModel:(WorldModel *)aModel andDoorLocators:(NSArray *)aDoorLocatorArray;
- (void)toggle;
@end
@interface WorldModel : NSObject {
BOOL horizontalDoorsOpen[3][2];
BOOL verticalDoorsOpen[2][3];
DoorKnob *doorKnobs[3][3];
DoorsCoordinates playerPosition;
}
@property DoorsCoordinates playerPosition;
// invalid (x,y) implies false
- (BOOL)isHorizontalDoorOpenAtX:(int)x andY:(int)y;
- (BOOL)isHorizontalDoorOpen:(DoorsDoorCoordinates)doorCoordinates;
- (BOOL)isVerticalDoorOpenAtX:(int)x andY:(int)y;
- (BOOL)isVerticalDoorOpen:(DoorsDoorCoordinates)doorCoordinates;
- (void)openAllDoors;
- (void)closeHorizontalDoorAtX:(int)x andY:(int)y;
- (void)closeVerticalDoorAtX:(int)x andY:(int)y;
- (void)setDoorKnobAtX:(int)x andY:(int)y withDoors:(NSArray *)aDoorLocatorArray;
- (void)operateDoorKnob;
- (BOOL)moveInDirection:(Class)direction;
- (BOOL)playerAtTargetPosition;
@end
@interface WorldModel (private)
- (BOOL)directionImpliesHorizontalDoor:(Class)direction;
- (DoorsDoorCoordinates) doorCoordinatesAt:(DoorsCoordinates)position andDirection:(Class)direction;
- (void)toggleDoor:(DoorLocator *)doorLocator;
- (BOOL)canMoveFrom:(DoorsCoordinates)position inDirection:(Class)direction;
- (void)operateDoorKnobAtX:(int)x andY:(int)y;
@end