Class TBehaviorList

DescriptionHierarchyFieldsMethodsProperties

Unit

Behaviors

Declaration

type TBehaviorList = class(TTenaciousObject)

Description

Container class for TBehaviors.

Hierarchy

TBehaviorList > TTenaciousObject > TPersistent

Methods

Overview

Public constructor Create; override;
Public constructor CreateAndSet(List: TBehaviorList);
Public destructor Destroy; override;
Public procedure Add(Behavior: TBehavior; MakeCopy: Boolean);
Public procedure AddAsStrings(Strings: TStringList);
Public procedure Clear;
Public procedure LoadFromDefinition(ObjDef: TObjectDefinition);

Description

Public constructor Create; override;

Constructor

Public constructor CreateAndSet(List: TBehaviorList);

Copy constructor. CreateAndSet creates a copy of the supplied container object (List) by calling TBehavior.Copy for each behavior in List.

parameters
List
is the container to be copied.
Public destructor Destroy; override;

Destructor

Public procedure Add(Behavior: TBehavior; MakeCopy: Boolean);

Adds a behavior to the list (or a copy of the behavior).

parameters
Behavior
is the behavior to be added to the list.
MakeCopy
is set to True if the list should add a copy of Behavior (calling TBehavior.Copy). In this case, the user is responsible for destroying Behavior. If set to False, the ownership of the supplied behavior (Behavior) is transferred to the list and will be destroyed upon calling the destructor Destroy.
Public procedure AddAsStrings(Strings: TStringList);

Adds the name of all behaviors (and any sub-behaviors) as strings to a list of strings. This procedure loops through all behaviors, calling TBehavior.AddAsStrings for each behavior.

Public procedure Clear;

Clears the list of behaviors by calling the destructor TBehavior.Destroy for each contained behavior and sets Count to zero.

Public procedure LoadFromDefinition(ObjDef: TObjectDefinition);

Procedure for processing the definition of a behavior list (as parsed from the definition text file). This procedure is automatically called from TBrain.LoadFromDefinition and does not need to be called explicitly.

Properties

Overview

Public property ActiveBehaviorIndex: integer;
Public property Count: integer;
Public property Level: Integer;
Public property M[i: integer]: TBehavior;

Description

Public property ActiveBehaviorIndex: integer;

Get the index of the behavior having the highest utility. Use this property together with the default property M to get the behavior with the highest utility value. It should be noted that if all behaviors have the same utility value, the first behavior index is returned (index = 1).

Public property Count: integer;

Number of behaviors in the container.

Public property Level: Integer;

Hierarchical level of the list (top level is equal to 1).

Public property M[i: integer]: TBehavior;

Default array property that returns a behavior based on an index number. Use this property to access any behavior contained in the list. The index (i) goes from 1 to Count.


Generated by PasDoc 0.8.8.3 on 2005-05-28 08:13:49