mirror of
https://github.com/Kugelschieber/go-game.git
synced 2026-01-18 06:40:28 +00:00
27 lines
453 B
Go
27 lines
453 B
Go
package goga
|
|
|
|
// An actor ID is a unique integer,
|
|
// which can be used to reference an actor.
|
|
type ActorId uint64
|
|
|
|
// A basic actor, having a unique ID.
|
|
// Use NewActor() to create new actors.
|
|
type Actor struct {
|
|
id ActorId
|
|
}
|
|
|
|
var (
|
|
actorIdGen = ActorId(0)
|
|
)
|
|
|
|
// Creates a new basic actor with unique ID.
|
|
func NewActor() *Actor {
|
|
actorIdGen++
|
|
return &Actor{actorIdGen}
|
|
}
|
|
|
|
// Returns the ID of actor.
|
|
func (a *Actor) GetId() ActorId {
|
|
return a.id
|
|
}
|