Documentation
¶
Index ¶
- Variables
- func CreateUUID() string
- type BaseNode
- type BehaviorTree
- type Blackboard
- type Context
- type Decorator
- type Inverter
- type Limiter
- type MaxTime
- type Memory
- type Node
- type NodeCategorie
- type Priority
- type RepeatUntilFailure
- type RepeatUntilSuccess
- type Repeater
- type Sequence
- type Status
- type Wait
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SUCCESS = Status("Success") FAILURE = Status("Failure") RUNNING = Status("Runnig") ERROR = Status("Error") COMPOSITE = NodeCategorie("Composite") DECORATOR = NodeCategorie("Decorator") ACTION = NodeCategorie("Action") CONDITION = NodeCategorie("Condition") )
Functions ¶
func CreateUUID ¶
func CreateUUID() string
Types ¶
type BaseNode ¶
type BaseNode struct { ID string Name string Category NodeCategorie Title string Description string }
func CreateBaseNode ¶
type BehaviorTree ¶
type BehaviorTree struct { Id string Title string Description string Root Node *Blackboard }
func CreateBehaviorTree ¶
func CreateBehaviorTree(title, desc string, blackboard *Blackboard) *BehaviorTree
func (*BehaviorTree) GetNodeMemory ¶
func (this *BehaviorTree) GetNodeMemory(node Node) *Memory
func (*BehaviorTree) GetTreeMemory ¶
func (this *BehaviorTree) GetTreeMemory() *Memory
func (*BehaviorTree) Tick ¶
func (this *BehaviorTree) Tick(context *Context) Status
type Blackboard ¶
type Blackboard struct {
// contains filtered or unexported fields
}
func CreateBlackboard ¶
func CreateBlackboard() *Blackboard
func (*Blackboard) GetBaseMemory ¶
func (this *Blackboard) GetBaseMemory() *Memory
type Context ¶
type Context struct { *BehaviorTree ContextId string Target interface{} // contains filtered or unexported fields }
func CreateContext ¶
func CreateContext(target interface{}) *Context
func (*Context) GetContextMemory ¶
type Decorator ¶
type Decorator struct { BaseNode // contains filtered or unexported fields }
*
- Decorator is the base class for all decorator nodes. Thus, if you want to
- create new custom decorator nodes, you need to inherit from this class.
*
type Inverter ¶
type Inverter struct {
Decorator
}
*
- The Inverter decorator inverts the result of the child, returning `SUCCESS`
- for `FAILURE` and `FAILURE` for `SUCCESS`. *
func NewInverter ¶
type Limiter ¶
type Limiter struct { Decorator // contains filtered or unexported fields }
*
- This decorator limit the number of times its child can be called. After a
- certain number of times, the Limiter decorator returns `FAILURE` without
- executing the child. *
type MaxTime ¶
type MaxTime struct { Decorator // contains filtered or unexported fields }
*
- The MaxTime decorator limits the maximum time the node child can execute.
- Notice that it does not interrupt the execution itself (i.e., the child
- must be non-preemptive), it only interrupts the node after a `RUNNING`
- status.
*
type Memory ¶
type Memory struct { Integer map[string]int Float map[string]float32 Complex map[string]complex64 Byte map[string]byte Rune map[string]rune Bool map[string]bool String map[string]string Memory map[string]*Memory Time map[string]time.Time ArrayInteger map[string][]int ArrayFloat map[string][]float32 ArrayComplex map[string][]complex64 ArrayByte map[string][]byte ArrayRune map[string][]rune ArrayBool map[string][]bool ArrayString map[string][]string ArrayNode map[string][]Node }
func CreateMemory ¶
func CreateMemory() *Memory
type NodeCategorie ¶
type NodeCategorie string
type Priority ¶
type Priority struct { BaseNode // contains filtered or unexported fields }
*
- Priority contexts its children sequentially until one of them returns
- `SUCCESS`, `RUNNING` or `ERROR`. If all children return the failure state,
- the priority also returns `FAILURE`.
*
func NewPriority ¶
type RepeatUntilFailure ¶
type RepeatUntilFailure struct { Decorator // contains filtered or unexported fields }
func NewRepeatUntilFailure ¶
func NewRepeatUntilFailure(title string, maxLoop int, child Node) *RepeatUntilFailure
func (*RepeatUntilFailure) Open ¶
func (this *RepeatUntilFailure) Open(context *Context)
func (*RepeatUntilFailure) Tick ¶
func (this *RepeatUntilFailure) Tick(context *Context) Status
type RepeatUntilSuccess ¶
type RepeatUntilSuccess struct { Decorator // contains filtered or unexported fields }
func NewRepeatUntilSuccess ¶
func NewRepeatUntilSuccess(title string, maxLoop int, child Node) *RepeatUntilSuccess
func (*RepeatUntilSuccess) Open ¶
func (this *RepeatUntilSuccess) Open(context *Context)
func (*RepeatUntilSuccess) Tick ¶
func (this *RepeatUntilSuccess) Tick(context *Context) Status
type Repeater ¶
type Repeater struct { Decorator // contains filtered or unexported fields }
*
- Repeater is a decorator that repeats the tick signal until the child node
- return `RUNNING` or `ERROR`. Optionally, a maximum number of repetitions
- can be defined.
*
type Sequence ¶
type Sequence struct { BaseNode // contains filtered or unexported fields }
*
- The Sequence node contexts its children sequentially until one of them
- returns `FAILURE`, `RUNNING` or `ERROR`. If all children return the
- success state, the sequence also returns `SUCCESS`. *
func NewSequence ¶
Click to show internal directories.
Click to hide internal directories.