game

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatar

type Avatar struct {
	ID        string
	User      *entities.User
	Character *characters.Character
}

Avatar ... default active entity that moves in the world Avatars can be either controlled by Players/Users or be attached/belong to bots Once a user is logged in he automatically gets attached his last used aavatar

func NewAvatar

func NewAvatar() *Avatar

NewAvatar ... creates and returns a new room instance

type Game

type Game struct {

	// access to repository data
	Facade service.Facade

	SystemUser *entities.User

	OnUserJoined chan *m.UserJoined
	OnUserQuit   chan *m.UserQuit

	Receivers []Receiver

	CommandProcessor *c.CommandProcessor
	RoomProcessor    *c.RoomProcessor

	Avatars map[string]*Avatar
	// contains filtered or unexported fields
}

Game ... contains live game state

func New

func New(facade service.Facade) *Game

New creates a new game instance

func (*Game) GetFacade

func (g *Game) GetFacade() service.Facade

GetFacade ...

func (*Game) OnMessageReceived

func (g *Game) OnMessageReceived() chan interface{}

OnMessageReceived returns onMessageReceived channel

func (*Game) Run

func (g *Game) Run()

Run main game loop

func (*Game) SendMessage

func (g *Game) SendMessage() chan interface{}

SendMessage ...

func (*Game) Unsubscribe

func (g *Game) Unsubscribe(receiver *Receiver)

Unsubscribe ...

type Receiver

type Receiver interface {
	OnMessage(message interface{})
}

Receiver ... rec

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL