Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AwayTeamGoal = Goal{ Place: HomeTeam, Center: physics.Point{PosX: units.FieldWidth, PosY: units.FieldHeight / 2}, TopPole: physics.Point{PosX: units.FieldWidth, PosY: units.GoalMaxY}, BottomPole: physics.Point{PosX: units.FieldWidth, PosY: units.GoalMinY}, }
AwayTeamGoal works as a constant value to help to retrieve a Goal struct with the values of the Away team goal
var FieldCenter = physics.Point{units.FieldWidth / 2, units.FieldHeight / 2}
FieldCenter works as a constant value to help to retrieve a Point struct with the values of the center of the court
var HomeTeamGoal = Goal{ Place: HomeTeam, Center: physics.Point{PosX: 0, PosY: units.FieldHeight / 2}, TopPole: physics.Point{PosX: 0, PosY: units.GoalMaxY}, BottomPole: physics.Point{PosX: 0, PosY: units.GoalMinY}, }
HomeTeamGoal works as a constant value to help to retrieve a Goal struct with the values of the Home team goal
Functions ¶
func Cleanup ¶
func Cleanup(interrupted bool)
Cleanup executes all cleaner functions in the stack passing the arg that tells if the process was interrupted or not
func RegisterCleaner ¶
RegisterCleaner creates a stack of call back functions to be executed when the main process ends
Types ¶
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
Cleaner binds a callback function and a label to help us to identify the tasks that are executed during the cleaning stack
type GameState ¶
type GameState string
GameState is a game state
const ( //WaitingTeams game state when the game server is waiting for both team's players connections WaitingTeams GameState = "waiting" //Ready game state when the game server is ready to start Ready GameState = "ready" //Listening game state when the game server is listening the player for orders Listening GameState = "listening" //Playing game state when the game server is executing the orders sent during the last `listening` state Playing GameState = "playing" //Pause game state when the game server is paused by a debug command and waiting for the `next step` signal Pause GameState = "pause" //Results game state when the game server is announcing the score change Results GameState = "results" //Over game state when the game server is is announcing the end of the game Over GameState = "game-over" )
type Goal ¶
type Goal struct { // Center the is coordinate of the center of the goal Center physics.Point // Place identifies the team of this goal (the team that should defend this goal) Place TeamPlace // TopPole is the coordinates of the pole with a higher Y coordinate TopPole physics.Point // BottomPole is the coordinates of the pole with a lower Y coordinate BottomPole physics.Point }
Goal is a set of value about a goal from a team
type PlayerNumber ¶
type PlayerNumber string
PlayerNumber identifies values for players number
const ( // GoalkeeperNumber defines the goalkeeper number GoalkeeperNumber PlayerNumber = "1" )
type PlayerSpecifications ¶
type PlayerSpecifications struct { // Number identifies the number of the player in its team Number PlayerNumber `json:"number"` // InitialCoords identifies where default initial player's position is InitialCoords physics.Point `json:"initial_coords"` // Token should be passed as an argument to the player to ensure that the connection is being openned by the expected process Token string `json:"token"` // ProtocolVersion identifies the game server communication version the player is compatible with (e.g. 1.0) ProtocolVersion string `json:"protocol_version"` }
PlayerSpecifications is the object that should be present in the HTTP websocket headers connection open by the player with the game server
type Task ¶
type Task struct { OnStop func(*Task) // contains filtered or unexported fields }
Task allow us to create a task in background
func (*Task) StopRequested ¶
StopRequested returns true when the task was requested to stop