// --- Public methods of the class Player --- /// <summary>The default constructor creates a new human player and gives it a new id.</summary> public Player(Position position) { if (_instanceCounter >= 2) { // The number of players to created exceeds 2: throw new PSTException("Player: Trying to create more than two players"); } _id = _instanceCounter; ++_instanceCounter; // By default the player is a human: _species = Species.Human; // Set some default for the computer strength: _computerStrength = ComputerStrength.Medium; _position = position; // By default the player's name is taken from the resources, i.e. something like "Player #1": _name = KalahaResources.I.GetRes("Player", (_id + 1)); }
/// <summary>Sets the species of the player.</summary> /// <param name="species">The species the player shall have</param> /// <param name="strength">The computer's strength (with default param mainly if the species is Human)</param> public void SetSpecies(Species species, ComputerStrength strength = ComputerStrength.Medium) { _species = species; //DEBUG Logging.Inst.LogMessage(this.ToString() + ": Species set to " + _species + ".\n"); if (_species == Species.Computer) { _computerStrength = strength; //DEBUG Logging.Inst.LogMessage(this.ToString() + ": Strength set to " + _computerStrength + ".\n"); } }