jens@10: // jens@10: // Player.h jens@10: // YourMove jens@10: // jens@10: // Created by Jens Alfke on 7/3/08. jens@10: // Copyright 2008 Jens Alfke. All rights reserved. jens@10: // jens@10: jens@10: #import jens@10: @class Game; jens@10: jens@10: jens@10: /** A mostly-passive object used to represent a player. */ jens@10: @interface Player : NSObject jens@10: { jens@10: Game *_game; jens@13: NSString *_name; jens@10: BOOL _local; jens@13: NSMutableDictionary *_extraValues; jens@10: } jens@10: jens@10: - (id) initWithGame: (Game*)game; jens@10: - (id) initWithName: (NSString*)name; jens@10: jens@10: - (id) initWithCoder: (NSCoder*)decoder; jens@10: - (void) encodeWithCoder: (NSCoder*)coder; jens@10: jens@13: @property (copy) NSString *name; // Display name jens@13: @property (readonly) CGImageRef icon; // An icon to display (calls game.iconForPlayer:) jens@13: jens@10: @property (readonly) Game *game; jens@10: @property (readonly) int index; // Player's index in the Game's -players array jens@13: @property (readwrite,getter=isLocal) BOOL local; // Is player a human at this computer? (Defaults to YES) jens@10: @property (readonly, getter=isCurrent) BOOL current; // Is it this player's turn? jens@10: @property (readonly, getter=isFriendly) BOOL friendly; // Is this player the current player or an ally? jens@10: @property (readonly, getter=isUnfriendly) BOOL unfriendly; // Is this player an opponent of the current player? jens@10: @property (readonly) Player *nextPlayer, *previousPlayer; // The next/previous player in sequence jens@14: jens@14: /** Copy all of the player's attributes (name, local...) into myself. */ jens@14: - (void) copyFrom: (Player*)player; jens@10: @end jens@10: jens@10: jens@10: jens@10: @interface CALayer (Game) jens@10: jens@10: /** Called on any CALayer in the game's layer tree, will return the current Game object. */ jens@10: @property (readonly) Game *game; jens@10: jens@10: @end