object

package
v0.0.0-...-7004f9a Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseObject

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

BaseObject defines the root game object.

func New

func New(components ...Component) *BaseObject

New returns a new game object.

func (*BaseObject) AddComponents

func (o *BaseObject) AddComponents(components ...Component)

AddComponents adds components to the entity.

func (*BaseObject) GetComponent

func (o *BaseObject) GetComponent(name string) Component

func (*BaseObject) HasComponent

func (o *BaseObject) HasComponent(name string) bool

HasComponent returns whether the current object has the specified component.

func (*BaseObject) ID

func (o *BaseObject) ID() uint64

ID returns the BaseObject's ID.

func (*BaseObject) RemoveComponent

func (o *BaseObject) RemoveComponent(name string)

type Component

type Component interface {
	Name() string
}

Component represents an abstract component.

type GameObject

type GameObject interface {
	ID() uint64

	AddComponents(c ...Component)
	HasComponent(componentName string) bool
	GetComponent(componentName string) Component
	RemoveComponent(componentName string)
}

Jump to

Keyboard shortcuts

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