world

package
v4.0.0-rc3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type    EventType
	Payload interface{}
}

type EventType

type EventType uint8
const (
	EventTypeError EventType = iota
	EventTypeObjectCreate
	EventTypeObjectDelete
	EventTypeObjectUpdate
	EventTypeObjectChecked
)

func (EventType) MarshalJSON

func (event EventType) MarshalJSON() ([]byte, error)

func (EventType) String

func (event EventType) String() string

type World

type World struct {
	// contains filtered or unexported fields
}

func NewWorld

func NewWorld(width, height uint8) (*World, error)

func (*World) CreateObject

func (w *World) CreateObject(object interface{}, location engine.Location) error

func (*World) CreateObjectAvailableDots

func (w *World) CreateObjectAvailableDots(object interface{}, location engine.Location) (engine.Location, error)

func (*World) CreateObjectRandomByDotsMask

func (w *World) CreateObjectRandomByDotsMask(object interface{}, dm *engine.DotsMask) (engine.Location, error)

func (*World) CreateObjectRandomDot

func (w *World) CreateObjectRandomDot(object interface{}) (engine.Location, error)

func (*World) CreateObjectRandomRect

func (w *World) CreateObjectRandomRect(object interface{}, rw, rh uint8) (engine.Location, error)

func (*World) CreateObjectRandomRectMargin

func (w *World) CreateObjectRandomRectMargin(object interface{}, rw, rh, margin uint8) (engine.Location, error)

func (*World) DeleteObject

func (w *World) DeleteObject(object interface{}, location engine.Location) error

func (*World) EntityExists

func (w *World) EntityExists(object interface{}, location engine.Location) bool

func (*World) Events

func (w *World) Events(stop <-chan struct{}, buffer uint) <-chan Event

func (*World) GetEntityByDot

func (w *World) GetEntityByDot(dot engine.Dot) (interface{}, engine.Location)

func (*World) GetObjectByDot

func (w *World) GetObjectByDot(dot engine.Dot) interface{}

func (*World) GetObjectByLocation

func (w *World) GetObjectByLocation(location engine.Location) interface{}

func (*World) GetObjects

func (w *World) GetObjects() []interface{}

func (*World) GetObjectsByDots

func (w *World) GetObjectsByDots(dots []engine.Dot) []interface{}

func (*World) Height

func (w *World) Height() uint8

func (*World) LocationExists

func (w *World) LocationExists(location engine.Location) bool

func (*World) LocationOccupied

func (w *World) LocationOccupied(location engine.Location) bool

func (*World) Navigate

func (w *World) Navigate(dot engine.Dot, dir engine.Direction, dis uint8) (engine.Dot, error)

func (*World) ObjectExists

func (w *World) ObjectExists(object interface{}) bool

func (*World) Size

func (w *World) Size() uint16

func (*World) Start

func (w *World) Start(stop <-chan struct{})

func (*World) UpdateObject

func (w *World) UpdateObject(object interface{}, old, new engine.Location) error

func (*World) UpdateObjectAvailableDots

func (w *World) UpdateObjectAvailableDots(object interface{}, old, new engine.Location) (engine.Location, error)

func (*World) Width

func (w *World) Width() uint8

Jump to

Keyboard shortcuts

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