Documentation ¶
Index ¶
- type Ai
- func (ai *Ai) Init(graph *Graph)
- func (ai *Ai) Reset()
- func (ai *Ai) SetCurTool(value byte)
- func (ai *Ai) SetDelayedPauseSteps(steps uint8)
- func (ai *Ai) SetPauseSteps(steps uint8)
- func (ai *Ai) SetResource(idx byte, value bool)
- func (ai *Ai) SetTool(idx byte, value byte)
- func (ai *Ai) Step() (idxFrom, idxTo byte, useTool bool, err *Error)
- type Graph
- type NodeT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ai ¶
Ai is a component that represents AI actor. One instance is for one user enemy. This component is independent.
func NewAi ¶
NewAi creates a new Ai. Please do not create a Ai directly. "xyFunc" - function to locate an AI actor on the battle field in case of reset "bewareFunc" - function to determine if AI should be scared of a cell with given coordinates
func (*Ai) SetCurTool ¶
SetCurTool assigns current tool for the AI "value" - tool ID
func (*Ai) SetDelayedPauseSteps ¶
SetDelayedPauseSteps is the same as SetPauseSteps, except that the AI will get paused only AFTER he finishes his current path
func (*Ai) SetPauseSteps ¶
SetPauseSteps sets delay for the AI in "steps". The AI will do nothing during this time (by default 5 steps stand for 1 sec)
func (*Ai) SetResource ¶
SetResource sets or unsets the resource in a given graph node "idx" - graph node number "value" - TRUE to set the resourse, and FALSE to unset one
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph structure represents a graph: set of nodes connected with set of arcs
func (*Graph) AddArc ¶
AddArc connects a node number "n" with a node number "pointsTo". "direction" means the following: 0 = left 1 = right 2 = up 3 = down
func (*Graph) AddNode ¶
AddNode adds a node with number "n" to the graph. "danger" parameter indicates what resource should be used to eliminate the danger. Pass 0 if the node is not dangerous