Game Development Reference
In-Depth Information
If the lh]uan object's [d]oGau property is pnqa, three things happen:
1. The code checks to see whether the door is closed. It checks the value of the `kknKja eoKlaj
getter. If it returns b]hoa, the door is closed. It checks for a b]hoa value by using the jkp ()
operator.
2. If the door is closed, the `kknKja eoKlaj setter is sent the value of pnqa, which “opens the
door.” The door becomes invisible, and the chimes sound plays. Figure 8-19 illustrates how this
works. I'll explain how the sound works in the section ahead, and you'll find the full @kkn class
listed as follows.
Door Class isOpen getter
lq^he_bqj_pekjcap eoKlaj $%6>kkha]j
w
napqnj[eoKlaj7
y
DungeonOne_Manager Class
eb$lh]uan*d]oGau%
w
eb$`kknKja* eoKlaj %
w
`kknKja* eoKlaj 9pnqa7
`kknGau*reoe^ha9b]hoa7
y
y
Door Class isOpen setter
lq^he_bqj_pekjoap eoKlaj $`kknOp]pa6>kkha]j%
w
[eoKlaj9`kknOp]pa7
eb$[eoKlaj%
w
[okqj`?d]jjah9[_deiao*lh]u$%7
reoe^ha9b]hoa7
y
ahoa
w
reoe^ha9pnqa7
y
y
Figure 8-19. The DungeonOne_Manager class finds out whether the door is open by checking the Door
class's getter. It opens the door by using a setter to set the Door class's _isOpen property to true.
3. The `kknGau's reoe^ha property is set to b]hoa, so it seems to disappear.`kknKja is bound to
the @kkn class:
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel7
eilknpbh]od*ia`e]*Okqj`7
eilknpbh]od*ia`e]*Okqj`?d]jjah7
eilknpbh]od*arajpo*Arajp7
 
Search Nedrilad ::




Custom Search