49 |
|
|
50 |
/** |
/** |
51 |
* Change the object health. |
* Change the object health. |
52 |
|
* Post an notification named "updateObject" containing the current game and |
53 |
|
* the current object. |
54 |
*/ |
*/ |
55 |
- (void) setHealth: (unsigned)health |
- (void) setHealth: (unsigned)health |
56 |
{ |
{ |
57 |
[[NSNotificationCenter defaultCenter] |
_health = health; |
|
postNotificationName:@"updateObject" object: [self game]]; |
|
58 |
|
|
59 |
_health = health; |
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
60 |
|
object: [self game] |
61 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
62 |
|
forKey: @"HgObject"]]; |
63 |
} |
} |
64 |
|
|
65 |
/** |
/** |
72 |
|
|
73 |
/** |
/** |
74 |
* Change the object mass. |
* Change the object mass. |
75 |
|
* Post an notification named "updateObject" containing the current game and |
76 |
|
* the current object. |
77 |
*/ |
*/ |
78 |
- (void) setMass: (unsigned)mass |
- (void) setMass: (unsigned)mass |
79 |
{ |
{ |
80 |
_mass = mass; |
_mass = mass; |
81 |
|
|
82 |
|
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
83 |
|
object: [self game] |
84 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
85 |
|
forKey: @"HgObject"]]; |
86 |
} |
} |
87 |
|
|
88 |
/** |
/** |
95 |
|
|
96 |
/** |
/** |
97 |
* Change the object hullShield. |
* Change the object hullShield. |
98 |
|
* Post an notification named "updateObject" containing the current game and |
99 |
|
* the current object. |
100 |
*/ |
*/ |
101 |
- (void) setHullShield: (unsigned)hullShield |
- (void) setHullShield: (unsigned)hullShield |
102 |
{ |
{ |
103 |
[[NSNotificationCenter defaultCenter] |
_hullShield = hullShield; |
|
postNotificationName:@"updateObject" object: [self game]]; |
|
104 |
|
|
105 |
_hullShield = hullShield; |
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
106 |
|
object: [self game] |
107 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
108 |
|
forKey: @"HgObject"]]; |
109 |
} |
} |
110 |
|
|
111 |
/** |
/** |
118 |
|
|
119 |
/** |
/** |
120 |
* Change the object deckShield. |
* Change the object deckShield. |
121 |
|
* Post an notification named "updateObject" containing the current game and |
122 |
|
* the current object. |
123 |
*/ |
*/ |
124 |
- (void) setDeckShield: (unsigned)deckShield |
- (void) setDeckShield: (unsigned)deckShield |
125 |
{ |
{ |
126 |
[[NSNotificationCenter defaultCenter] |
_deckShield = deckShield; |
|
postNotificationName:@"updateObject" object: [self game]]; |
|
127 |
|
|
128 |
_deckShield = deckShield; |
[[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject" |
129 |
|
object: [self game] |
130 |
|
userInfo: [NSDictionary dictionaryWithObject: self |
131 |
|
forKey: @"HgObject"]]; |
132 |
} |
} |
133 |
|
|
134 |
@end |
@end |
136 |
@implementation HgStatic (NSCoding) |
@implementation HgStatic (NSCoding) |
137 |
|
|
138 |
/** |
/** |
139 |
* NSCoding method |
* NSCoding method to encode and decode objects |
|
* to encode and decode objects |
|
140 |
*/ |
*/ |
141 |
- (void)encodeWithCoder: (NSCoder *)encoder |
- (void)encodeWithCoder: (NSCoder *)encoder |
142 |
{ |
{ |