ecs

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentBase

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

func (*ComponentBase) EId

func (s *ComponentBase) EId() string

func (*ComponentBase) Init

func (s *ComponentBase) Init(EId string)

type ComponentType

type ComponentType interface {
	ComponentType() uint64
	String() string
}

type Entity

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

func NewEntity

func NewEntity(id string) *Entity

func (*Entity) ComponentCombId

func (s *Entity) ComponentCombId() uint64

func (*Entity) DelComponent

func (s *Entity) DelComponent(c ...IComponent)

func (*Entity) GetAllComponent

func (s *Entity) GetAllComponent() map[ComponentType]IComponent

func (*Entity) GetComponent

func (s *Entity) GetComponent(t ComponentType) IComponent

func (*Entity) Id

func (s *Entity) Id() string

func (*Entity) RangeComponent

func (s *Entity) RangeComponent(f func(ComponentType, IComponent), ts ...ComponentType)

func (*Entity) ResetComponent

func (s *Entity) ResetComponent()

func (*Entity) SetComponent

func (s *Entity) SetComponent(c ...IComponent)

重复组件就替换,否则就添加

func (*Entity) SetId

func (s *Entity) SetId(eid string)

func (*Entity) SetType

func (s *Entity) SetType(t int64)

func (*Entity) Type

func (s *Entity) Type() int64

type EntityCollection

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

type IComponent

type IComponent interface {
	Type() ComponentType
	EId() string
	Init(EId string)
}

type ITuple

type ITuple interface {
	Init(comps map[ComponentType]IComponent)
}

type Runtime

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

func NewRuntime

func NewRuntime() *Runtime

func (*Runtime) AddEntity

func (s *Runtime) AddEntity(ent *Entity) error

entity operate : add

func (*Runtime) AddSingleComponent

func (s *Runtime) AddSingleComponent(components ...IComponent) error

func (*Runtime) AddSystem

func (s *Runtime) AddSystem(news ...System) error

func (*Runtime) DeleteEntity

func (s *Runtime) DeleteEntity(eid string) bool

entity operate : delete

func (*Runtime) GetEntity

func (s *Runtime) GetEntity(eid string) *Entity

func (*Runtime) RangeSystem

func (s *Runtime) RangeSystem(f func(System) bool)

func (*Runtime) Run

func (s *Runtime) Run(dt float64, time_set map[string]int64) int64

返回此次更新运行总时长

func (*Runtime) SingleComponent

func (s *Runtime) SingleComponent(componentType ComponentType) IComponent

type System added in v1.0.7

type System interface {
	UpdateFrame(dt float64)
	EssentialComp() uint64
	// contains filtered or unexported methods
}

type SystemBase

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

func NewSystemBase

func NewSystemBase(t string, rt *Runtime, tt reflect.Type) *SystemBase

func (*SystemBase) GetTuple

func (s *SystemBase) GetTuple(EId string) ITuple

func (*SystemBase) Range

func (s *SystemBase) Range(f func(eid string, tuple ITuple) bool)

func (*SystemBase) Runtime

func (s *SystemBase) Runtime() *Runtime

func (*SystemBase) Type

func (s *SystemBase) Type() string

Jump to

Keyboard shortcuts

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