entity

package
v0.0.0-...-50e9496 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2013 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FreeID

func FreeID(id int32)

func GetID

func GetID() int32

func RegisterSystem

func RegisterSystem(sys System)

Shouldn't be called after init

Types

type EntityComponent

type EntityComponent struct {
	ID     int32
	Uuid   string
	Server Server
	World  *world.World

	CurrentTick uint64

	Systems []System
}

func (*EntityComponent) Entity

func (e *EntityComponent) Entity() *EntityComponent

func (*EntityComponent) Init

func (e *EntityComponent) Init(root interface{})

func (*EntityComponent) UUID

func (e *EntityComponent) UUID() string

Returns the entity's UUID

func (*EntityComponent) Update

func (e *EntityComponent) Update(root interface{})

type LastPositionComponent

type LastPositionComponent struct {
	MovedChunk          bool
	LastCX, LastCZ      int32
	LastX, LastY, LastZ float64
	LastYaw, LastPitch  float32
}

func (*LastPositionComponent) LastPosition

func (lp *LastPositionComponent) LastPosition() *LastPositionComponent

type PositionComponent

type PositionComponent struct {
	CX, CZ     int32
	X, Y, Z    float64
	Yaw, Pitch float32
}

func (*PositionComponent) Position

func (p *PositionComponent) Position() *PositionComponent

type Priority

type Priority int
const (
	Highest Priority = iota
	High
	Normal
	Low
	Lowest
)

type Server

type Server interface {
}

Contains methods that a entity needs for a server

type System

type System interface {
	Update(e interface{})
	Valid(e interface{}) bool
	Priority() Priority
}

func Systems

func Systems(e interface{}) []System

type SystemMovable

type SystemMovable struct{}

func (SystemMovable) Priority

func (SystemMovable) Priority() Priority

func (SystemMovable) Update

func (SystemMovable) Update(entity interface{})

Updates the entity's movement and moves the chunk its in if required

func (SystemMovable) Valid

func (SystemMovable) Valid(e interface{}) bool

type TickSystem

type TickSystem struct{}

func (TickSystem) Priority

func (TickSystem) Priority() Priority

func (TickSystem) Update

func (TickSystem) Update(entity interface{})

func (TickSystem) Valid

func (TickSystem) Valid(e interface{}) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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