behavior_tree

package
v0.0.0-...-1c5f5a9 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeStateSuccess NodeState = iota
	NodeStateFailure           = 1
	NodeStateRunning           = 2
	NodeStateCancel            = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseBehaviorNode

type BaseBehaviorNode struct {
	Children []BehaviorNode
	// contains filtered or unexported fields
}

func (*BaseBehaviorNode) AddChild

func (slf *BaseBehaviorNode) AddChild(nodes ...BehaviorNode)

func (*BaseBehaviorNode) GetChildren

func (slf *BaseBehaviorNode) GetChildren() []BehaviorNode

func (*BaseBehaviorNode) GetTree

func (slf *BaseBehaviorNode) GetTree() *BehaviorTree

func (*BaseBehaviorNode) SetTree

func (slf *BaseBehaviorNode) SetTree(tree *BehaviorTree)

type BehaviorNode

type BehaviorNode interface {
	Run() NodeState
	AddChild(nodes ...BehaviorNode)
	GetChildren() []BehaviorNode
	SetTree(tree *BehaviorTree)
	GetTree() *BehaviorTree
}

type BehaviorTree

type BehaviorTree struct {
	Root BehaviorNode
	// contains filtered or unexported fields
}

func NewBehaviorTree

func NewBehaviorTree(root BehaviorNode, opts ...Option) *BehaviorTree

func (*BehaviorTree) GetProperty

func (slf *BehaviorTree) GetProperty(key string) any

func (*BehaviorTree) Run

func (slf *BehaviorTree) Run(cycle, duration time.Duration)

func (*BehaviorTree) SetProperty

func (slf *BehaviorTree) SetProperty(key string, value any)

type NodeState

type NodeState int

type Option

type Option func(*BehaviorTree)

func WithData

func WithData(data map[string]any) Option

type RandomSelectorNode

type RandomSelectorNode struct {
	BaseBehaviorNode
}

func NewRandomSelectorNode

func NewRandomSelectorNode() *RandomSelectorNode

func (*RandomSelectorNode) Run

func (slf *RandomSelectorNode) Run() NodeState

type SelectorNode

type SelectorNode struct {
	BaseBehaviorNode
}

func NewSelectorNode

func NewSelectorNode() *SelectorNode

func (*SelectorNode) Run

func (slf *SelectorNode) Run() NodeState

type SequenceNode

type SequenceNode struct {
	BaseBehaviorNode
}

func NewSequenceNode

func NewSequenceNode() *SequenceNode

func (*SequenceNode) Run

func (slf *SequenceNode) Run() NodeState

Jump to

Keyboard shortcuts

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