嗨,有人可以向我解释一下苹果的精灵套件冒险游戏中接口的使用。
他们有一个名为的主类APAMultiplayerLayeredCharacterScene
和另一个从该类继承的类APAAdventureScene
。
他们在APAMultiplayerLayeredCharacterScene
.h 中有一堆属性,如下所示:
@interface APAMultiplayerLayeredCharacterScene : SKScene
@property (nonatomic, readonly) NSArray *players; // array of player objects or NSNull for no player
@property (nonatomic, readonly) APAPlayer *defaultPlayer; // player '1' controlled by keyboard/touch
@property (nonatomic, readonly) SKNode *world; // root node to which all game renderables are attached
@property (nonatomic) CGPoint defaultSpawnPoint; // the point at which heroes are spawned
@property (nonatomic) BOOL worldMovedForUpdate; // indicates the world moved before or during the current update
@property (nonatomic, readonly) NSArray *heroes; // all heroes in the game
现在在 .m 文件中,他们有这个:
@interface APAMultiplayerLayeredCharacterScene ()
@property (nonatomic) NSMutableArray *players; // array of player objects or NSNull for no player
@property (nonatomic) APAPlayer *defaultPlayer; // player '1' controlled by keyboard/touch
@property (nonatomic) SKNode *world; // root node to which all game renderables are attached
@property (nonatomic) NSMutableArray *layers; // different layer nodes within the world
@property (nonatomic, readwrite) NSMutableArray *heroes;// our fearless adventurers
@property (nonatomic) NSArray *hudAvatars; // keep track of the various nodes for the HUD
@property (nonatomic) NSArray *hudLabels; // - there are always 'kNumPlayers' instances in each array
@property (nonatomic) NSArray *hudScores;
@property (nonatomic) NSArray *hudLifeHeartArrays; // an array of NSArrays of life hearts
@property (nonatomic) NSTimeInterval lastUpdateTimeInterval; // the previous update: loop time interval
@end
@implementation APAMultiplayerLayeredCharacterScene
有人可以向我解释这两组属性的用途,类使用哪些属性以及可以从继承自它的类中访问哪些属性?
我对它的工作原理感到困惑,因为这些属性都没有被合成,所以我不明白为什么要使用它们。我以前从未以这种方式使用过它们。
非常感谢!