ecs

package
v0.3.37 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateECS

func CreateECS(updateTime int64, timeScale float32, server bool) lokas.IRuntime

func CreateEntity

func CreateEntity() lokas.IEntity

func CreateRuntime added in v0.2.32

func CreateRuntime(updateTime int64, timeScale float32, server bool) lokas.IRuntime

func GetComponentName

func GetComponentName(ecs lokas.IRuntime, c Component) string

func GetComponentSyncAble

func GetComponentSyncAble(ecs lokas.IRuntime, c interface{}) bool

func HasEntityInSlice

func HasEntityInSlice(slice []*Entity, e *Entity) bool

func NewComponentPool

func NewComponentPool(creator ComponentCreator, comp lokas.IComponent) lokas.IComponentPool

Types

type Component

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

func (*Component) Dirty added in v0.1.24

func (this *Component) Dirty() bool

func (*Component) GetComponentName

func (this *Component) GetComponentName() string

func (*Component) GetEntity added in v0.0.6

func (this *Component) GetEntity() lokas.IEntity

func (*Component) GetRuntime

func (this *Component) GetRuntime() lokas.IRuntime

func (*Component) GetSibling

func (this *Component) GetSibling(t protocol.BINARY_TAG) lokas.IComponent

func (*Component) SetDirty

func (this *Component) SetDirty(d bool)

func (*Component) SetEntity

func (this *Component) SetEntity(e lokas.IEntity)

func (*Component) SetRuntime

func (this *Component) SetRuntime(r lokas.IRuntime)

type ComponentCreator

type ComponentCreator func(args ...interface{}) lokas.IComponent

type ComponentPool

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

func (*ComponentPool) Create

func (this *ComponentPool) Create(args ...interface{}) lokas.IComponent

func (*ComponentPool) Destroy

func (this *ComponentPool) Destroy()

func (*ComponentPool) Get

func (this *ComponentPool) Get() lokas.IComponent

func (*ComponentPool) Pop

func (this *ComponentPool) Pop() lokas.IComponent

func (*ComponentPool) PopAndDestroy

func (this *ComponentPool) PopAndDestroy()

func (*ComponentPool) Recycle

func (this *ComponentPool) Recycle(comp lokas.IComponent)

type Entity

type Entity struct {
	events.EventEmmiter
	// contains filtered or unexported fields
}

func (*Entity) Add

func (this *Entity) Add(c lokas.IComponent)

func (*Entity) AddByTag

func (this *Entity) AddByTag(t protocol.BINARY_TAG) lokas.IComponent

func (*Entity) Clone

func (this *Entity) Clone() *Entity

func (*Entity) Components

func (this *Entity) Components() map[protocol.BINARY_TAG]lokas.IComponent

func (*Entity) Dirty

func (this *Entity) Dirty() bool

func (*Entity) Get

func (this *Entity) Get(t protocol.BINARY_TAG) lokas.IComponent

func (*Entity) GetId

func (this *Entity) GetId() util.ID

func (*Entity) GetOrCreate added in v0.0.6

func (this *Entity) GetOrCreate(t protocol.BINARY_TAG) lokas.IComponent

func (*Entity) Includes

func (this *Entity) Includes(componentTypeArray []reflect.Type) bool

func (*Entity) Init

func (this *Entity) Init()

func (*Entity) MarkDirty

func (this *Entity) MarkDirty(c lokas.IComponent)

func (*Entity) MarkDirtyByName

func (this *Entity) MarkDirtyByName(name string)

func (*Entity) Remove

func (this *Entity) Remove(t protocol.BINARY_TAG) lokas.IComponent

func (*Entity) RemoveAll added in v0.0.8

func (this *Entity) RemoveAll()

func (*Entity) SetDirty

func (this *Entity) SetDirty(d bool)

func (*Entity) SetId

func (this *Entity) SetId(id util.ID)

type EntityRef

type EntityRef struct {
	Id util.ID
	// contains filtered or unexported fields
}

func (*EntityRef) Entity

func (this *EntityRef) Entity() lokas.IEntity

type Group

type Group interface {
	Init(compGroup []string, ecs Runtime)
	AddEntity(e Entity)
}

func CreateGroup

func CreateGroup(compGroup []string, ecs Runtime) Group

type Runtime

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

func (*Runtime) CreateEntity

func (this *Runtime) CreateEntity() lokas.IEntity

func (*Runtime) CurrentTick

func (this *Runtime) CurrentTick() int64

func (*Runtime) GetComponentType

func (this *Runtime) GetComponentType(name string) reflect.Type

func (*Runtime) GetContext

func (this *Runtime) GetContext(name string) interface{}

func (*Runtime) GetEntity

func (this *Runtime) GetEntity(id util.ID) lokas.IEntity

func (*Runtime) GetTimeScale

func (this *Runtime) GetTimeScale() float32

func (*Runtime) Init

func (this *Runtime) Init(updateTime int64, timeScale float32, server bool)

func (*Runtime) IsServer

func (this *Runtime) IsServer() bool

func (*Runtime) IsSyncAble

func (this *Runtime) IsSyncAble(compName string) bool

func (*Runtime) MarkDirtyEntity added in v0.0.2

func (this *Runtime) MarkDirtyEntity(e lokas.IEntity)

func (*Runtime) RegisterComponent

func (this *Runtime) RegisterComponent(name string, c lokas.IComponent)

func (*Runtime) RegisterSingleton

func (this *Runtime) RegisterSingleton(name string, c lokas.IComponent)

func (*Runtime) RunningTime

func (this *Runtime) RunningTime() int64

func (*Runtime) SetContext

func (this *Runtime) SetContext(name string, value interface{})

func (*Runtime) SetTimeScale

func (this *Runtime) SetTimeScale(scale float32)

func (*Runtime) Start

func (this *Runtime) Start()

func (*Runtime) Stop

func (this *Runtime) Stop()

Jump to

Keyboard shortcuts

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