C# Класс MBC.Core.Game.Match

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

AddPlayer() публичный Метод

Adds a player to the match.
public AddPlayer ( Player plr ) : bool
plr Player
Результат bool

AddTeam() публичный Метод

Adds a team to the match.
public AddTeam ( Team newTeam ) : bool
newTeam Team
Результат bool

IsShotValid() защищенный Метод

Determines whether or not a given shot is valid within the parameters of the match.
protected IsShotValid ( Shot shot ) : bool
shot Shot
Результат bool

Match() публичный Метод

Creates a match with parameters loaded from a configuration.
public Match ( Configuration config ) : System
config Configuration
Результат System

Play() публичный Метод

Moves the match progress forward at a standard pace.
public Play ( ) : void
Результат void

PlayLogic() защищенный Метод

protected PlayLogic ( ) : bool
Результат bool

PlayerDisqualified() публичный Метод

Signals a disqualification event against a player for a specific reason.
public PlayerDisqualified ( Player plr, string reason ) : bool
plr Player
reason string
Результат bool

PlayerLost() публичный Метод

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
Результат bool

PlayerMessage() защищенный Метод

Call when a player is outputting a message.
protected PlayerMessage ( Player plr, string msg ) : void
plr Player
msg string
Результат void

PlayerSetShips() публичный Метод

Sets the ships that are assigned to a player.
public PlayerSetShips ( Player plr, IList ships ) : bool
plr Player
ships IList
Результат bool

PlayerShipDestroyed() защищенный Метод

Call when a ship from a player has been destroyed.
protected PlayerShipDestroyed ( Player plr, Ship destroyedShip ) : void
plr Player
destroyedShip Ship
Результат void

PlayerShot() публичный Метод

Use when a player shoots.
public PlayerShot ( Player plr, Shot shot ) : bool
plr Player
shot Shot
Результат bool

PlayerShot() публичный Метод

Use when a player shoots and hits a ship.
public PlayerShot ( Player plr, Shot shot, Ship shipHit ) : bool
plr Player
shot Shot
shipHit Ship
Результат bool

PlayerTeamAssign() публичный Метод

Assign a player to a team.
public PlayerTeamAssign ( Player plr, Team newTeam ) : bool
plr Player
newTeam Team
Результат bool

PlayerTimeout() публичный Метод

Call when a player has timed out.
public PlayerTimeout ( Player plr, ControllerTimeoutException ex ) : void
plr Player
ex MBC.Core.Threading.ControllerTimeoutException
Результат void

PlayerWin() публичный Метод

Call when a player has won a round.
public PlayerWin ( Player plr ) : void
plr Player
Результат void

RemovePlayer() публичный Метод

Call when a player is to be removed from the match.
public RemovePlayer ( Player plr ) : bool
plr Player
Результат bool

RemoveTeam() публичный Метод

Call when a team is to be removed from the match.
public RemoveTeam ( Team remTeam ) : bool
remTeam Team
Результат bool

SetParameters() защищенный Метод

Changes the match parameters to reflect the configuration given.
protected SetParameters ( Configuration conf ) : void
conf Configuration
Результат void

ShipsValid() публичный Метод

Checks if a player's ship are placed, and are valid within the parameters of the match.
public ShipsValid ( Player player ) : bool
player Player
Результат bool

Stop() публичный Метод

Stops progression of the match.
public Stop ( ) : void
Результат void