logic

package
v0.0.0-...-7483609 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: MIT Imports: 3 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateWorld

func CreateWorld(wm munfall.WorldMap) munfall.World

CreateWorld creates and initializes the World.

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

type TraitCreate struct {
	Name       string
	Type       reflect.Type
	Parameters map[string]interface{}
}

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.

Jump to

Keyboard shortcuts

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