You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
593 B
Go
32 lines
593 B
Go
package main
|
|
|
|
import ()
|
|
|
|
type DeadState struct {
|
|
CommandSuite
|
|
start int64
|
|
}
|
|
|
|
func NewDeadState(died int64) ConnectionState {
|
|
return &DeadState{start: died}
|
|
}
|
|
|
|
func (d *DeadState) Enter(c *Connection) {
|
|
c.Printf("You are dead.\n")
|
|
}
|
|
|
|
func (d *DeadState) Tick(c *Connection, frame int64) ConnectionState {
|
|
if frame-d.start > options.respawnFrames {
|
|
return c.game.SpawnPlayer()
|
|
}
|
|
return d
|
|
}
|
|
|
|
func (d *DeadState) Exit(c *Connection) {
|
|
c.Printf("You're alive again.\n")
|
|
}
|
|
|
|
func (d *DeadState) String() string { return "dead" }
|
|
|
|
func (d *DeadState) FillStatus(c *Connection, s *status) {}
|