C# Class MBC.Core.Game.Match

Afficher le fichier Open project: aiclub/Mohawk_Battleship Class Usage Examples

Méthodes publiques

Méthode Description
AddPlayer ( Player plr ) : bool

Adds a player to the match.

AddTeam ( Team newTeam ) : bool

Adds a team to the match.

Match ( Configuration config ) : System

Creates a match with parameters loaded from a configuration.

Play ( ) : void

Moves the match progress forward at a standard pace.

PlayerDisqualified ( Player plr, string reason ) : bool

Signals a disqualification event against a player for a specific reason.

PlayerLost ( Player plr ) : bool

Marks a player as a loser in the current round and increases their losing score. Player must be active in order to lose, otherwise this method returns false.

PlayerSetShips ( Player plr, IList ships ) : bool

Sets the ships that are assigned to a player.

PlayerShot ( Player plr, Shot shot ) : bool

Use when a player shoots.

PlayerShot ( Player plr, Shot shot, Ship shipHit ) : bool

Use when a player shoots and hits a ship.

PlayerTeamAssign ( Player plr, Team newTeam ) : bool

Assign a player to a team.

PlayerTimeout ( Player plr, ControllerTimeoutException ex ) : void

Call when a player has timed out.

PlayerWin ( Player plr ) : void

Call when a player has won a round.

RemovePlayer ( Player plr ) : bool

Call when a player is to be removed from the match.

RemoveTeam ( Team remTeam ) : bool

Call when a team is to be removed from the match.

ShipsValid ( Player player ) : bool

Checks if a player's ship are placed, and are valid within the parameters of the match.

Stop ( ) : void

Stops progression of the match.

Méthodes protégées

Méthode Description
IsShotValid ( Shot shot ) : bool

Determines whether or not a given shot is valid within the parameters of the match.

PlayLogic ( ) : bool
PlayerMessage ( Player plr, string msg ) : void

Call when a player is outputting a message.

PlayerShipDestroyed ( Player plr, Ship destroyedShip ) : void

Call when a ship from a player has been destroyed.

SetParameters ( Configuration conf ) : void

Changes the match parameters to reflect the configuration given.

Private Methods

Méthode Description
AppendEvent ( MBC.Core.Events.Event ev ) : void

Appends an event to the list of events of the match, with a proper timestamp.

ApplyParameters ( Configuration conf ) : void

Applies a configuration to the match.

EndRound ( ) : void

Notifies the end of a round.

MatchEnd ( ) : bool

Called when the match ends.

NewRound ( ) : void

Notifies a new round beginning.

NotifyParamsChanged ( ) : void

Notifies match parameter changes.

Method Details

AddPlayer() public méthode

Adds a player to the match.
public AddPlayer ( Player plr ) : bool
plr Player
Résultat bool

AddTeam() public méthode

Adds a team to the match.
public AddTeam ( Team newTeam ) : bool
newTeam Team
Résultat bool

IsShotValid() protected méthode

Determines whether or not a given shot is valid within the parameters of the match.
protected IsShotValid ( Shot shot ) : bool
shot Shot
Résultat bool

Match() public méthode

Creates a match with parameters loaded from a configuration.
public Match ( Configuration config ) : System
config Configuration
Résultat System

Play() public méthode

Moves the match progress forward at a standard pace.
public Play ( ) : void
Résultat void

PlayLogic() protected méthode

protected PlayLogic ( ) : bool
Résultat bool

PlayerDisqualified() public méthode

Signals a disqualification event against a player for a specific reason.
public PlayerDisqualified ( Player plr, string reason ) : bool
plr Player
reason string
Résultat bool

PlayerLost() public méthode

Marks a player as a loser in the current round and increases their losing score. Player must be active in order to lose, otherwise this method returns false.
public PlayerLost ( Player plr ) : bool
plr Player
Résultat bool

PlayerMessage() protected méthode

Call when a player is outputting a message.
protected PlayerMessage ( Player plr, string msg ) : void
plr Player
msg string
Résultat void

PlayerSetShips() public méthode

Sets the ships that are assigned to a player.
public PlayerSetShips ( Player plr, IList ships ) : bool
plr Player
ships IList
Résultat bool

PlayerShipDestroyed() protected méthode

Call when a ship from a player has been destroyed.
protected PlayerShipDestroyed ( Player plr, Ship destroyedShip ) : void
plr Player
destroyedShip Ship
Résultat void

PlayerShot() public méthode

Use when a player shoots.
public PlayerShot ( Player plr, Shot shot ) : bool
plr Player
shot Shot
Résultat bool

PlayerShot() public méthode

Use when a player shoots and hits a ship.
public PlayerShot ( Player plr, Shot shot, Ship shipHit ) : bool
plr Player
shot Shot
shipHit Ship
Résultat bool

PlayerTeamAssign() public méthode

Assign a player to a team.
public PlayerTeamAssign ( Player plr, Team newTeam ) : bool
plr Player
newTeam Team
Résultat bool

PlayerTimeout() public méthode

Call when a player has timed out.
public PlayerTimeout ( Player plr, ControllerTimeoutException ex ) : void
plr Player
ex MBC.Core.Threading.ControllerTimeoutException
Résultat void

PlayerWin() public méthode

Call when a player has won a round.
public PlayerWin ( Player plr ) : void
plr Player
Résultat void

RemovePlayer() public méthode

Call when a player is to be removed from the match.
public RemovePlayer ( Player plr ) : bool
plr Player
Résultat bool

RemoveTeam() public méthode

Call when a team is to be removed from the match.
public RemoveTeam ( Team remTeam ) : bool
remTeam Team
Résultat bool

SetParameters() protected méthode

Changes the match parameters to reflect the configuration given.
protected SetParameters ( Configuration conf ) : void
conf Configuration
Résultat void

ShipsValid() public méthode

Checks if a player's ship are placed, and are valid within the parameters of the match.
public ShipsValid ( Player player ) : bool
player Player
Résultat bool

Stop() public méthode

Stops progression of the match.
public Stop ( ) : void
Résultat void