78 |
|
|
79 |
/** |
/** |
80 |
* Change the player acceleration. |
* Change the player acceleration. |
81 |
|
* Post an notification named "updatePlayerState" containing the current game |
82 |
|
* and the current object. |
83 |
*/ |
*/ |
84 |
- (void) setAcceleration :(float)acceleration |
- (void) setAcceleration :(float)acceleration |
85 |
{ |
{ |
|
[[NSNotificationCenter defaultCenter] |
|
|
postNotificationName:@"updateObject" object: [_player game]]; |
|
|
|
|
86 |
_acceleration = acceleration; |
_acceleration = acceleration; |
87 |
|
|
88 |
|
[[NSNotificationCenter defaultCenter] |
89 |
|
postNotificationName: @"updatePlayerState" |
90 |
|
object: [_player game] |
91 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
92 |
|
forKey: @"HgPlayerState"]]; |
93 |
} |
} |
94 |
|
|
95 |
/** |
/** |
102 |
|
|
103 |
/** |
/** |
104 |
* Change the player direction. |
* Change the player direction. |
105 |
|
* Post an notification named "updatePlayerState" containing the current game |
106 |
|
* and the current object. |
107 |
*/ |
*/ |
108 |
- (void) setDirection : (float)direction |
- (void) setDirection : (float)direction |
109 |
{ |
{ |
|
[[NSNotificationCenter defaultCenter] |
|
|
postNotificationName:@"updateObject" object: [_player game]]; |
|
|
|
|
110 |
_direction = direction; |
_direction = direction; |
111 |
|
|
112 |
|
[[NSNotificationCenter defaultCenter] |
113 |
|
postNotificationName: @"updatePlayerState" |
114 |
|
object: [_player game] |
115 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
116 |
|
forKey: @"HgPlayerState"]]; |
117 |
} |
} |
118 |
|
|
119 |
|
|
145 |
|
|
146 |
/** |
/** |
147 |
* Change the player canonDirection. |
* Change the player canonDirection. |
148 |
|
* Post an notification named "updatePlayerState" containing the current game |
149 |
|
* and the current object. |
150 |
*/ |
*/ |
151 |
- (void) setCanonDirection: (float)canonDirection |
- (void) setCanonDirection: (float)canonDirection |
152 |
{ |
{ |
|
[[NSNotificationCenter defaultCenter] |
|
|
postNotificationName:@"updateObject" object: [_player game]]; |
|
|
|
|
153 |
_canonDirection = canonDirection; |
_canonDirection = canonDirection; |
154 |
|
|
155 |
|
[[NSNotificationCenter defaultCenter] |
156 |
|
postNotificationName: @"updatePlayerState" |
157 |
|
object: [_player game] |
158 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
159 |
|
forKey: @"HgPlayerState"]]; |
160 |
} |
} |
161 |
|
|
162 |
/** |
/** |
169 |
|
|
170 |
/** |
/** |
171 |
* Change the player canonElevation. |
* Change the player canonElevation. |
172 |
|
* Post an notification named "updatePlayerState" containing the current game |
173 |
|
* and the current object. |
174 |
*/ |
*/ |
175 |
- (void) setCanonElevation: (unsigned)canonElevation |
- (void) setCanonElevation: (unsigned)canonElevation |
176 |
{ |
{ |
|
[[NSNotificationCenter defaultCenter] |
|
|
postNotificationName:@"updateObject" object: [_player game]]; |
|
|
|
|
177 |
_canonElevation = canonElevation; |
_canonElevation = canonElevation; |
178 |
|
|
179 |
|
[[NSNotificationCenter defaultCenter] |
180 |
|
postNotificationName: @"updatePlayerState" |
181 |
|
object: [_player game] |
182 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
183 |
|
forKey: @"HgPlayerState"]]; |
184 |
} |
} |
185 |
|
|
186 |
@end |
@end |
188 |
@implementation HgPlayerState (NSCoding) |
@implementation HgPlayerState (NSCoding) |
189 |
|
|
190 |
/** |
/** |
191 |
* NSCoding protocol |
* NSCoding protocol to encode and decode objects |
|
* to encode and decode objects |
|
192 |
*/ |
*/ |
193 |
- (void)encodeWithCoder: (NSCoder *)encoder |
- (void)encodeWithCoder: (NSCoder *)encoder |
194 |
{ |
{ |