Documentation ¶
Overview ¶
Package logic actor.go Defines something
Package logic actorregistry.go Defines a container for actor definitions so they can be easily added to the world.
Package logic traitmanager.go Defines a storage for traits supporting easy lookup and add/removal.
Package logic world.go Defines our world type that runs the game.
Index ¶
- func CreateWorld(wm munfall.WorldMap) munfall.World
- type ActorDefinition
- type ActorRegistry
- func (ar *ActorRegistry) CreateActor(name string, runtimeParameters map[string]interface{}, w munfall.World, ...) munfall.Actor
- func (ar *ActorRegistry) DisposeActor(a munfall.Actor, w munfall.World)
- func (ar *ActorRegistry) RegisterActor(definition *ActorDefinition)
- func (ar *ActorRegistry) RegisterTrait(name string, t interface{})
- type TraitCreate
- type TraitDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActorDefinition ¶
type ActorDefinition struct { Name string // contains filtered or unexported fields }
ActorDefinition holds all the information needed to make an Actor.
func CreateActorDefinition ¶
func CreateActorDefinition(name string) *ActorDefinition
CreateActorDefinition creates a new actor definition, initialzed with the given name.
func (*ActorDefinition) AddTrait ¶
func (ad *ActorDefinition) AddTrait(def *TraitDefinition)
AddTrait adds a trait that will be constructed and added to the actor when this ActorDefinition is used to create an actor.
type ActorRegistry ¶
type ActorRegistry struct {
// contains filtered or unexported fields
}
ActorRegistry contains definitions for actors.
func CreateActorRegistry ¶
func CreateActorRegistry() *ActorRegistry
CreateActorRegistry creates and initializes an ActorRegistry.
func (*ActorRegistry) CreateActor ¶
func (ar *ActorRegistry) CreateActor(name string, runtimeParameters map[string]interface{}, w munfall.World, addToWorld bool) munfall.Actor
CreateActor creates an actor in the given world by using the trait parameters registered to the given name and the provided runtime parameters.
func (*ActorRegistry) DisposeActor ¶
func (ar *ActorRegistry) DisposeActor(a munfall.Actor, w munfall.World)
DisposeActor disposes of all the traits from the world.
func (*ActorRegistry) RegisterActor ¶
func (ar *ActorRegistry) RegisterActor(definition *ActorDefinition)
RegisterActor adds trait parameters to the registered actor name, used by the CreateActor method to
func (*ActorRegistry) RegisterTrait ¶
func (ar *ActorRegistry) RegisterTrait(name string, t interface{})
RegisterTrait adds a trait type as a candidate for creation, panics if it already exists.
type TraitCreate ¶
TraitCreate holds all the information needed to create a trait.
type TraitDefinition ¶
type TraitDefinition struct { Type string // contains filtered or unexported fields }
TraitDefinition used for constructing a trait.
func CreateTraitDefinition ¶
func CreateTraitDefinition(Type string) *TraitDefinition
CreateTraitDefinition creates a struct for creating traits.
func (*TraitDefinition) AddParameter ¶
func (td *TraitDefinition) AddParameter(parameterName string, value interface{}) *TraitDefinition
AddParameter adds a parameter to the trait, returns the definintion it is called on for easy chaining.