Source/Player.h
author Jens Alfke <jens@mooseyard.com>
Mon Jul 07 15:47:42 2008 -0700 (2008-07-07)
changeset 12 4e567e11f45f
child 13 db7bb080c3d5
permissions -rw-r--r--
Added new convenience methods for Game implementations.
     1 //
     2 //  Player.h
     3 //  YourMove
     4 //
     5 //  Created by Jens Alfke on 7/3/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 @class Game;
    11 
    12 
    13 /** A mostly-passive object used to represent a player. */
    14 @interface Player : NSObject <NSCoding>
    15 {
    16     Game *_game;
    17     NSString *_name, *_uuid, *_address, *_addressType;
    18     BOOL _local;
    19 }
    20 
    21 - (id) initWithGame: (Game*)game;
    22 - (id) initWithName: (NSString*)name;
    23 
    24 - (id) initWithCoder: (NSCoder*)decoder;
    25 - (void) encodeWithCoder: (NSCoder*)coder;
    26 
    27 @property (readonly) Game *game;
    28 @property (copy) NSString *name,                            // Display name
    29                           *UUID,                            // Address Book UUID
    30                           *address,                         // Contact address
    31                           *addressType;                     // Contact address type (an AB property type)
    32 @property (readonly) int index;                             // Player's index in the Game's -players array
    33 @property (readwrite,getter=isLocal) BOOL local;            // Is the player on this computer? (Defaults to YES)
    34 @property (readonly, getter=isCurrent) BOOL current;        // Is it this player's turn?
    35 @property (readonly, getter=isFriendly) BOOL friendly;      // Is this player the current player or an ally?
    36 @property (readonly, getter=isUnfriendly) BOOL unfriendly;  // Is this player an opponent of the current player?
    37 @property (readonly) Player *nextPlayer, *previousPlayer;   // The next/previous player in sequence
    38 @property (readonly) CGImageRef icon;
    39 @end
    40 
    41 
    42 
    43 @interface CALayer (Game)
    44 
    45 /** Called on any CALayer in the game's layer tree, will return the current Game object. */
    46 @property (readonly) Game *game;
    47 
    48 @end