Behavior Designer
For
Malbers Animations
There is actually very little involved with the installation of the Behavior Designer for Malbers Animations. Just import and you’re done, so long as you have already installed:
A) Behavior Designer – Behavior Trees for Everyone version 1.7.9
B) Animal Controller (Malbers Character Controller) version 1.4.4c
This package will not work without both packages installed as it uses functionality from both to function. It is most probable that previous and post versions of these packages will also work but I have not tested any other version. I plan to release a new version of this package on any future breaking changes.
The following 75+ pages of documentation should be enough to help you understand what each of the following:
· 9 Conditionals
· 1 Decorator
· 27 Actions
do, how to set them up and finally how they work internally so that you can make changes, if need be.
There is no attempt to teach Behavior Designer or Malbers Animations in this documentation and you will have to resort to each’s corresponding documentation. Though I have added a few helpful tips where I thought you might need more information than what was provided by the other package’s documentation.
Due to the close reliance on the 2 packages, it is not possible to provide demos. But a have included a few External Behaviors to help give you an idea on how Behavior Designer for Malbers Animations works. But in most cases, you can just plug-and-play the Actions and Conditionals from the examples of most Behavior Designer tutorials, and they will work.
The only two things of note are one, that Malbers Animations seem to work best with Unity’s new Nav Mesh. If you find your animal floating and not animated, I recommend deleting the old Nav Mesh and installing the new version.
If you are unable to delete the old Nav Mesh, I found the following code helped me:
public class KillNavOldMesh : MonoBehaviour
{
[MenuItem("Light Brigade/Debug/Force Cleanup NavMesh")]
public static void ForceCleanupNavMesh()
{
if (Application.isPlaying)
return;
NavMesh.RemoveAllNavMeshData();
}
}
The second thing of note is that you attach the Behavior Designer Tree to a Malbers Animation character that is at least an Empty Controller and has:
1. AIController
2. NavMesh Agent
3. Animal Brain
Components, in the Game Object hierarchy Animal/Internal Components/AI, as shown in the image below.
The easiest way to get a correctly formatted Malbers Animated character is to select one of the Prefabs that end in AI or has the AI hierarchy (usual disabled and enable it), as the bases to create your character from. And disable the Malbers Input Component if found on the Prefab.
At the current time, since I don’t know what the response will be to this package, I am simply going to rely on email. But if that isn’t enough support in the future I may expand to other forms of interaction
Conditionals
The CanHearObject class is a conditional task for Behavior Designer , designed for use within the Unity game development environment. It evaluates whether any specified objects are within the hearing range of the agent it is attached to. This class is part of the Malbers Animations system and is categorized under auditory perception functionalities.
· targetObjects (SharedGameObjectList): A list of GameObjects that the agent attempts to hear.
· targetTag (SharedString): The tag used to identify target objects in the scene.
· targetLayerMask (SharedLayerMask): A LayerMask defining which layers contain the target objects.
· maxCollisionCount (SharedInt): The maximum number of colliders that the physics cast can process, for performance optimization.
· maxHearingRadius (SharedFloat): The maximum distance from the agent within which sounds can be heard.
· audibilityThreshold (SharedFloat): The minimum volume level at which a sound is considered audible by the agent.
· selfOffset (SharedVector3): A local space offset from the agent's position, used as the starting point for hearing checks.
· returnedLoudestObject (SharedGameObject): The GameObject of the loudest audible sound source detected during the last update cycle.
· OnStart(): Initializes the task, preparing any necessary data structures.
· OnUpdate(): Performs the hearing check against all specified targets and updates returnedLoudestObject with the loudest audible object, if any.
· WithinHearingRange(Transform, GameObject, ref float): Determines if a given target object is within hearing range and audible, returning the object if it meets the criteria.
· GetAudioSourcesForGameObject(GameObject): Retrieves or caches the AudioSource components associated with a target object.
· OnReset(): Resets the task's properties to their default values.
· OnDrawGizmos(): Visualizes the hearing radius in the Unity Editor for debugging purposes.
· OnBehaviorComplete(): Cleans up any resources or data structures when the behavior completes.
Attach this class to a Behavior Designer Conditional task within a GameObject that represents an agent capable of hearing. Configure the hearing properties and target specifications to match the desired behavior. The task will then periodically check for audible objects within its hearing radius and update the returnedLoudestObject property accordingly.
This class is particularly useful in AI systems where auditory perception plays a role in decision-making, such as in stealth games or simulations involving animal behavior.
The CanSeeObject class is a specialized conditional task for Behavior Designer, tailored for use within the Unity game development environment. It is designed to determine if any specified objects are within the line of sight of the agent it is attached to, ultimately returning the object that is most directly in front of the agent. This class is a part of the Malbers Animations system, focusing on visual perception functionalities.
· targetObjects (SharedGameObjectList): Targets specified as a list of GameObjects.
· targetTag (SharedString): Target specified by a tag.
· targetLayerMask (SharedLayerMask): Targets specified by a layer mask.
· maxCollisionCount (SharedInt): Limits the number of colliders considered in physics casts.
· maxViewDistance (SharedFloat): The maximum distance the agent can see.
· fieldOfViewAngle (SharedFloat): The angle representing the field of view of the agent.
· ignoreLayerMask (SharedLayerMask): Layers to ignore during line-of-sight checks.
· disableSelfColliderLayer (SharedBool): Option to disable the agent's collider layer during checks.
· selfOffset (SharedVector3): Offset for the starting point of the agent's sight.
· targetOffset (SharedVector3): Offset for the target's position considered during line-of-sight checks.
· debugLineOfVision (SharedBool): Enables visual debugging of the line of vision.
· returnedAheadObject (SharedGameObject): The object most directly in front of the agent that is within sight.
· OnStart(): Initializes the task, setting up necessary properties.
· OnUpdate(): Performs the line-of-sight checks and updates returnedAheadObject with the most directly ahead object that is visible.
· CheckTarget(GameObject, ref float): Checks if a specific target is within sight and updates the minimum angle if the target is more directly ahead.
· WithinSight(Transform, Vector3, GameObject, Vector3, out float, int) : Determines if a target object is within the agent's field of view and line of sight.
· LineOfSight(Transform, Vector3, GameObject, Vector3, int): Performs a line-of-sight check between the agent and a target object.
· IsAncestor(Transform, Transform): Checks if one transform is an ancestor of another, aiding in line-of-sight validation.
· GetColliderForGameObject(GameObject): Retrieves or caches the Collider component of a target object.
· OnReset(): Resets the task's properties to their default values.
· OnDrawGizmos(): Visualizes the agent's field of view in the Unity Editor for debugging purposes.
· OnBehaviorComplete(): Cleans up resources or data structures when the behavior completes.
Attach this class to a Behavior Designer Conditional task within a GameObject that represents an agent capable of visual perception. Configure the sight properties and target specifications to match the desired behavior. The task will then periodically check for visible objects within its field of view and update the returnedAheadObject property with the most directly ahead visible object.
This class is particularly useful in AI systems where visual perception plays a key role in decision-making, such as in stealth games, simulations involving predator-prey dynamics, or any scenario where line of sight detection is crucial.
The CheckModeAction class is a conditional task designed for Behavior Designer within Unity, specifically tailored for use with the Malbers Animations system. It checks whether an animal character, controlled by the MAnimal component, is currently in a specified mode or performing a specific ability within that mode.
· animal (SharedAnimal): The MAnimal component to check. If set to null, the task will default to checking the MAnimal component on the GameObject to which this script is attached.
· modeId (SharedModeID): The ID of the mode to check. Modes represent different states or behaviors an animal can be in, such as walking, flying, or swimming.
· actionId (SharedActionID): The ID of the specific action within the mode to check. If set to 0 or a negative value, the task will consider any action within the specified mode as valid.
· OnAwake(): Initializes the task by attempting to retrieve the MAnimal component from the attached GameObject.
· OnStart(): Called when the task starts. It updates the checkAnimal reference to the specified MAnimal component if the animal property is not null.
· OnUpdate(): The core logic of the task. It checks if the checkAnimal is in the specified mode and, if applicable, performs the specified action. It returns TaskStatus.Success if the conditions are met, otherwise, it returns TaskStatus.Failure.
· OnReset(): Resets the task's properties to their default values.
This class is intended to be used as a conditional node within a Behavior Designer behavior tree. It allows for the creation of complex AI behaviors that depend on the current state or action of an animal character. For example, it can be used to trigger specific behaviors when an animal enters a defensive mode or starts a particular ability.
The CheckSpeed class is a conditional task designed for Behavior Designer within Unity, specifically tailored for integration with the Malbers Animations system. It evaluates whether an animal character, controlled by the MAnimal component, is moving at a specified speed or performing a sprint action.
· animal (SharedAnimal): An optional reference to the MAnimal component to check. If set to null, the task will default to checking the MAnimal component on the GameObject to which this script is attached.
· speedSet (SharedString): The name of the Speed Set on the animal to check. Speed Sets define different movement states (e.g., "Ground", "Air") and their associated speeds.
· speedIndex (SharedInt): The index within the specified Speed Set to check against the animal's current speed. Each Speed Set can contain multiple speeds, identified by their index.
· sprint (SharedBool): Indicates whether to check if the animal is sprinting. Sprinting is typically a faster movement state that can be toggled on or off.
· OnAwake(): Initializes the task by attempting to retrieve the MAnimal component from the attached GameObject.
· OnStart(): Called when the task starts. It updates the checkAnimal reference to the specified MAnimal component if the animal property is not null.
· OnUpdate(): The core logic of the task. It checks if the checkAnimal is in the specified Speed Set and, if applicable, moving at the specified speed index or sprinting. It returns TaskStatus.Success if the conditions are met, otherwise, it returns TaskStatus.Failure.
· OnReset(): Resets the task's properties to their default values.
This class is intended to be used as a conditional node within a Behavior Designer behavior tree. It allows for the creation of complex AI behaviors that depend on the current movement state or speed of an animal character. For example, it can be used to trigger specific behaviors when an animal starts sprinting or when it moves at a particular speed within a defined Speed Set.
The CheckStance class is a conditional task designed for Behavior Designer within Unity, specifically tailored for integration with the Malbers Animations system. It evaluates whether an animal character, controlled by the MAnimal component, is currently in a specified stance.
· animal (SharedAnimal): An optional reference to the MAnimal component to check. If set to null, the task defaults to checking the MAnimal component on the GameObject to which this script is attached.
· stanceId (SharedStanceID): The ID of the stance to check. Stances represent different postures or states an animal can be in, such as sneaking, standing, sitting, or guarding down.
· OnAwake(): Initializes the task by attempting to retrieve the MAnimal component from the attached GameObject.
· OnStart(): Called when the task starts. It updates the checkAnimal reference to the specified MAnimal component if the animal property is not null.
· OnUpdate(): The core logic of the task. It checks if the checkAnimal is in the specified stance. It returns TaskStatus.Success if the condition is met, otherwise, it returns TaskStatus.Failure.
· OnReset(): Resets the task's properties to their default values.
This class is intended to be used as a conditional node within a Behavior Designer behavior tree. It allows for the creation of complex AI behaviors that depend on the current stance of an animal character. For example, it can be used to trigger specific behaviors when an animal enters a guarding stance or changes its posture.
The CheckStat class is a conditional task for Behavior Designer , designed for integration with the Malbers Animations system in Unity. It checks various conditions related to the stats of an animal character, controlled by the MAnimal component, such as health, stamina, or any custom stat defined within the Malbers Animations system.
· CheckStatOption: Defines the type of check to perform on the stat.
o Compare: Compares the stat's current value against a specified value.
o CompareNormalized: Compares the stat's normalized value (0 to 1) against a specified value.
o IsImmune: Checks if the stat is currently immune.
o Regenerating: Checks if the stat is currently regenerating.
o Degenerating: Checks if the stat is currently degenerating.
o IsEmpty: Checks if the stat's current value is at its minimum.
o IsFull: Checks if the stat's current value is at its maximum.
o IsActive: Checks if the stat is currently active.
· Operation: Defines the comparison operation to use when comparing stat values.
o LessThan
o LessThanOrEqualTo
o EqualTo
o NotEqualTo
o GreaterThanOrEqualTo
o GreaterThan.
· animal (SharedAnimal): Optional reference to the MAnimal component to check. Defaults to the component on the attached GameObject if null.
· statId (SharedStatID): The ID of the stat to check.
· option (CheckStatOption): The type of check to perform.
· operation (Operation): The comparison operation to use (relevant for Compare and CompareNormalized options).
· compareValue (SharedFloat): The value to compare against the stat's value (relevant for Compare and CompareNormalized options).
· OnAwake(): Initializes the task by attempting to retrieve the Stats component from the attached GameObject.
· OnStart(): Called when the task starts. Updates checkStats to reference the specified MAnimal component's Stats if the animal property is not null.
· OnUpdate(): The core logic of the task. Checks the specified stat against the defined conditions. Returns TaskStatus.Success if the conditions are met, otherwise returns TaskStatus.Failure.
· PerformCheckStat(Stat stat): Performs the specified check on the given stat.
· CompareWithValue(float stat): Compares the given stat value against compareValue using the specified operation.
· OnReset(): Resets the task's properties to their default values.
This class is intended to be used as a conditional node within a Behavior Designer behavior tree. It enables complex AI behaviors based on the current state of an animal character's stats, such as triggering behaviors when health is low, stamina is full, or a custom stat is within a certain range.
The CheckState class is a conditional task for Behavior Designer , specifically designed for integration with the Malbers Animations system in Unity. It checks if the animal character, controlled by the MAnimal component, is currently in a specified state.
· animal (SharedAnimal): An optional reference to the MAnimal component to check. If set to null, the task defaults to checking the MAnimal component on the GameObject to which this script is attached.
· stateId (SharedStateID): The ID of the state to check. States represent different behaviors or actions an animal can perform, such as idle, walk, or jump.
· OnAwake(): Initializes the task by attempting to retrieve the MAnimal component from the attached GameObject.
· OnStart(): Called when the task starts. It updates the checkAnimal reference to the specified MAnimal component if the animal property is not null.
· OnUpdate(): The core logic of the task. It checks if the checkAnimal is in the specified state. It returns TaskStatus.Success if the condition is met, otherwise, it returns TaskStatus.Failure.
· OnReset(): Resets the task's properties to their default values.
This class is intended to be used as a conditional node within a Behavior Designer behavior tree. It enables the creation of complex AI behaviors based on the current state of an animal character. For example, it can be used to trigger specific behaviors when an animal enters a specific state, such as reacting to an idle state by performing a specific action.
The CheckWeaponType class is a conditional task for Behavior Designer , specifically designed for integration with the Malbers Animations system in Unity. It checks the type of weapon currently equipped by an agent, such as an animal character controlled by the MAnimal component and determines if it matches a specified weapon type.
· WeaponType: Defines the types of weapons that can be checked.
o None: Indicates no weapon is equipped.
o Melee: Indicates a melee weapon is equipped.
o Range: Indicates a ranged weapon is equipped.
· animal (SharedAnimal): An optional reference to the MAnimal component to check. If set to null, the task defaults to checking the MAnimal component on the GameObject to which this script is attached.
· type (WeaponType): The type of weapon to check for. This determines what kind of weapon the task is looking for on the agent.
· OnAwake(): Initializes the task by attempting to retrieve the MWeaponManager component from the attached GameObject.
· OnStart(): Called when the task starts. If the animal property is not null, it updates the weaponManager reference to the MWeaponManager component of the specified MAnimal component.
· OnUpdate(): The core logic of the task. It checks if the currently equipped weapon matches the specified type. It returns TaskStatus.Success if the condition is met, otherwise, it returns TaskStatus.Failure.
· OnReset(): Resets the task's properties to their default values.
This class is intended to be used as a conditional node within a Behavior Designer behavior tree. It enables the creation of complex AI behaviors based on the current weapon type of an agent. For example, it can be used to trigger specific behaviors when an agent equips a melee weapon, a ranged weapon, or has no weapon equipped.
The WithinDistance class is a conditional task for Behavior Designer , designed for use within the Unity engine, particularly with the Malbers Animations system. It checks if any specified object, identified by a list, tag, or layer mask, is within a specified distance from the current agent. If an object is found within the distance, the closest one is returned.
· targetObjects (SharedGameObjectList): A list of GameObjects to check the distance against. This allows for specific objects to be targeted by the task.
· targetTag (SharedString): The tag of the objects to check the distance against. This allows for a broader selection of objects based on their assigned
· tags.targetLayerMask (SharedLayerMask): The LayerMask defining which layers to consider when checking for objects within distance. This is useful for filtering objects based on their layer.
· maxCollisionCount (SharedInt): Specifies the maximum number of colliders that the physics cast can collide with when using the object layer mask. This helps manage performance by limiting the number of collisions checked.
· maxDistance (SharedFloat): The maximum distance within which the objects need to be to satisfy the condition.
· lineOfSight (SharedBool): Determines whether the object must be within line of sight to be considered within distance. This can prevent objects behind walls from being considered within the specified distance.
· ignoreLayerMask (SharedLayerMask): The LayerMask of objects to ignore when performing the line-of-sight check. This is useful for ignoring specific layers that may obstruct the line of sight but should not be considered (e.g., a layer used for visual effects).
· selfOffset (SharedVector3): The offset from the agent's position from which the distance check is performed. This allows for adjustments based on the agent's pivot point.
· targetOffset (SharedVector3): The offset from the target's position to which the distance check is performed. This allows for adjustments based on the target's pivot point.
· returnedClosestObject (SharedGameObject): The closest object found within the specified distance. This is set by the task and can be used by other tasks within the behavior tree.
· OnStart(): Initializes the task, setting the closest distance squared based on the maxDistance property and resetting the returnedClosestObject.
· OnUpdate(): The core logic of the task. It checks each target object, tag, and layer mask to find objects within the specified distance and line of sight. It updates returnedClosestObject with the closest object found and returns TaskStatus.Success if an object is found, otherwise TaskStatus.Failure.
· IsWithinDistance(GameObject, ref float): Checks if a given GameObject is within the specified distance and, if lineOfSight is true, also within line of sight. Updates the closest distance squared if a closer object is found.
· LineOfSight(Transform, Vector3, GameObject, Vector3, int): Performs a line-of-sight check from the agent to the target object considering the specified offsets and ignoring the specified layer mask.
· IsAncestor(Transform, Transform): Determines if one transform is an ancestor of another, which is used in the line-of-sight check to handle cases where the target object is part of a composite object.GetColliderForGameObject(GameObject): Retrieves or caches the Collider component for a given GameObject. This is used in line-of-sight checks.
· OnReset(): Resets the task's properties to their default values.
· OnDrawGizmos(): Used in the Unity Editor to visually debug the task by drawing a wire disc representing the maxDistance.
· OnBehaviorComplete(): Clears the cached GameObject to Collider mappings when the behavior completes.
This class is intended to be used within a Behavior Designer behavior tree to conditionally execute tasks based on the proximity of objects to the agent. It can be used in a variety of scenarios, such as triggering an attack when an enemy is within a certain distance or moving towards an item if it is within reach.
Decorators
The WhileAlive class is a decorator task for Behavior Designer , specifically designed for integration with the Malbers Animations system in Unity. It controls the execution of its child task based on the life status of one or more animal characters, represented by the MAnimal component.
· animals (SharedAnimal[]): An array of SharedAnimal references. This property specifies the animals whose life status will be monitored. If set to null or left empty, the task will default to checking the life status of the animal attached to the same GameObject as this task.
· endOnFailure (SharedBool): Determines whether the task should stop executing its child task if the child task returns a failure status. If true, the decorator will stop executing the child task upon its failure.
· OnStart(): Called when the task starts. It initializes the targetAnimal list based on the animal's property. If animals are null or empty, it defaults to using the MAnimal component attached to the same GameObject.
· CanExecute(): Determines whether the child task can continue executing. It checks if all specified animals are alive and, based on the endOnFailure property, whether the child task has not returned a failure status.
· OnChildExecuted(TaskStatus childStatus): Called when the child task has finished execution. It updates the executionStatus with the status of the child task.
· OnEnd(): Called when the decorator task ends. It resets executionStatus to its initial value (TaskStatus.Inactive).
· OnReset(): Resets the public properties (endOnFailure) to their original values.
· AllAnimalsAlive(): Checks if all animals in the targetAnimal list are alive. An animal is considered alive if it is not in the Death state.
This class is used within a Behavior Designer behavior tree to control the execution of a child task based on the life status of specified animal characters. It is particularly useful in scenarios where an AI-controlled character should only perform certain actions while it or other specified characters are alive. For example, an AI character might continue to follow a leader character if it is alive.
Tasks
The AimAt class is a custom action for Behavior Designer , designed to work within the Unity engine and specifically tailored for integration with the Malbers Animations system. It controls the aiming behavior of an agent, such as an animal character, by enabling or disabling the aiming mechanism based on various conditions.
· isAiming (SharedBool): Determines whether aiming is active. If set to false, the weapon's aiming functionality is disabled.
· aimObject (SharedGameObject): The target GameObject at which the agent should aim. Aiming cannot be activated if this is set to null.
· checkRange (SharedBool): Specifies whether the agent should check if the target is within the max weapon range specified by the Aim component before aiming.
· OnAwake(): Initializes the task by retrieving references to the MAnimal, Aim, and MWeaponManager components on the agent.
· OnStart(): Called when the task starts. It sets the origin based on the AimOrigin property of the Aim component, if available.
· OnUpdate(): The core logic of the task. It checks the life status of the agent, the isAiming property, the presence of an aimObject, and the distance to the aimObject. Based on these checks, it enables or disables the aiming functionality and returns the appropriate TaskStatus.
· IsWithinDistance(GameObject, float): Determines if the aimObject is within the specified maximum distance specified by the Aim component from the origin.
· IsAnimalAlive(): Checks if the agent's MAnimal component is not in the Death state, indicating that the agent is alive.
· OnReset(): Resets the properties to their default values.
This class is used within a Behavior Designer behavior tree to control the aiming behavior of an agent. It allows for dynamic aiming based on the presence and distance of a target object, as well as the life status of the agent. This can be particularly useful in scenarios where an agent needs to aim at targets only when certain conditions are met, such as being alive, having a target within range, and the agent or game designer wanting to enable aiming.
The Attack class is a custom task designed for use within the Behavior Designer framework, specifically tailored for projects utilizing Malbers Animations assets. It orchestrates the attack behavior of characters by controlling weapon animations based on a randomized duration, potentially allowing for attack combinations if the attack spans a longer duration.
· minDuration(SharedFloat): Representing the minimum duration of an attack. This duration influences the potential for executing attack combinations; shorter durations may result in single attacks, while longer durations can trigger more complex attack combinations.
· maxDuration(SharedFloat): Representing the maximum duration of an attack. Like minDuration, this property affects the complexity of the attack combinations that can be performed, with longer durations allowing for more elaborate sequences.
· OnAwake(): Initializes the animal and weaponManager fields by fetching the respective components from the GameObject this script is attached to.
· OnStart(): Prepares the attack by randomizing the attack duration within the specified range and resetting relevant state flags.
· OnUpdate(): The core logic of the attack behavior. It checks if the animal is alive and if the weapon manager is available. It then progresses the attack timer, triggers the attack animation at the start, and concludes the attack when the duration elapses, returning appropriate TaskStatus values based on the attack's progression.
· IsAnimalAlive(): A helper method that checks if the animal is alive by ensuring it's not null and its state is not Death.
· OnReset(): Resets the minDuration and maxDuration properties to their default values. This method is called when the Behavior Designer task is reset.
This class is intended to be used as a task within a Behavior Designer behavior tree. It requires the GameObject to have both MAnimal and MWeaponManager components attached. The class manages the timing and execution of attacks, making it suitable for AI characters that require dynamic attack behaviors based on randomized durations.
The Cover class is a custom task designed for use within the Behavior Designer framework, specifically tailored for projects utilizing Malbers Animations assets. It enables AI characters to intelligently find and move to cover positions using Unity's NavMesh, enhancing realism and tactical behavior in game scenarios.
This class searches for suitable cover within a specified distance and directs the AI character to move behind it, optionally orienting the character to face a given target or direction once in cover. It leverages raycasting to identify potential cover spots and evaluates their suitability based on visibility from a designated target.
· maxCoverDistance (SharedFloat): Defines the maximum distance (in units) the AI will search for cover.
· availableLayerCovers (SharedLayerMask): Specifies the layers that are considered when searching for cover. This allows for filtering out non-cover objects in the environment.
· maxRayCasts (SharedInt): The maximum number of raycasts to perform during the search for cover. This limits computational effort. An equal number of steps are made to the left and right of the field of vision.
· rayStep (SharedFloat): Determines the angular step size (in degrees) between successive raycasts, affecting the spread of the search.
· lookAtCoverPoint (SharedBool): If true, the AI character will orient itself to face the cover point upon arrival.
· targetObject (SharedGameObject): The object from which the AI is seeking cover. If `null`, the AI will simply look ahead.
· OnAwake(): Initializes the animal and aiControl components.
· OnStart(): Begins the cover search process. It performs raycasts in a pattern around the character to find potential cover spots, considering the maxCoverDistance and availableLayerCovers. If a targetObject is specified, it ensures the cover position is not visible from this target.
· CannotBeSeen(): Helper method that checks if the cover position is out of sight from the targetObject, ensuring effective concealment.
· OnUpdate(): Manages the character's movement towards the cover position and handles orientation upon arrival based on the lookAtCoverPoint setting.
· IsAnimalAlive(): Checks if the animal component is active and not in a death state.
· OnEnd(): Called when the task ends, stopping the character's movement.
· OnReset(): Resets the properties to their default values, preparing the task for reuse.
This class is intended for use within a Behavior Designer behavior tree, enabling AI characters to dynamically find and use cover in their environment. It requires the GameObject to have both MAnimal and AnimalAIControl components attached for movement control and state management.
The Evade class is a custom task for use within the Behavior Designer framework, designed to facilitate evasion behavior for agents using Unity's NavMesh in conjunction with Malbers Animations. This class allows an agent to dynamically evade a specified target by calculating a path that increases the distance between the agent and the target, leveraging Unity's NavMesh for movement decisions.
· evadeDistance (SharedFloat): Defines the minimum distance at which the agent is considered to have successfully evaded the target. The evasion is deemed successful when the agent's distance from the target exceeds this value.
· lookAheadDistance (SharedFloat): Specifies the distance to look ahead when evading, influencing the direction in which the agent moves to evade the target.
· predictionDistance (SharedFloat): Determines the distance ahead of the target to predict when calculating the evasion path. Lower values suggest a shorter prediction distance.
· distancePredictionMultiplier (SharedFloat): A multiplier for adjusting the prediction of the look-ahead distance based on the agent's speed and the distance to the target.
· gameObjectToEvade (SharedGameObject): The GameObject that represents the target the agent is attempting to evade.
· maxIterations (SharedInt): The maximum number of iterations for setting the evasion position, preventing the agent from getting stuck in a loop.
· OnAwake(): Initializes the MAnimal and MAnimalAIControl components. This method is automatically called when the script is first loaded.
· OnStart(): Prepares the evasion behavior by verifying the agent's and AI control's availability, calculating the squared evade distance, and setting the initial target position. It also corrects maxIterations to a minimum of 1 if set to 0 or less.
· OnUpdate(): Executes the evasion logic each frame, calculating the target position for evasion and attempting to set the agent's destination. Returns a TaskStatus indicating the ongoing execution of the task.
· Target(int): Calculates the target position for evasion based on the current iteration, considering the agent's speed and the predicted movement of the target.
· SetDestination(Vector3, bool): Attempts to set the agent's destination to the calculated evasion position. It verifies the position's validity using Unity's NavMesh.
· SamplePosition(ref Vector3): Samples the NavMesh to find a valid position near the specified destination, ensuring the agent moves to a reachable location.
· Velocity(): Returns the current velocity of the agent, used in calculating the target's future position.
· OnEnd(): Called when the evasion task ends, stopping the agent's movement if AI control is available.
· IsAnimalAlive(): Checks if the agent is alive by verifying the MAnimal component's state is not Death.
· OnReset(): Resets the public variables to their default values, preparing the task for re-execution.
This class is intended for use within a Behavior Designer task, enabling dynamic evasion behavior in agents equipped with Malbers Animations components. It requires the agent to have a MAnimal component for state checking and optionally an MAnimalAIControl component for AI-driven movement.
The Flee class is a custom task for use within the Behavior Designer framework, designed to enable agents to flee from a specified GameObject using Unity's NavMesh. This class is tailored for use with Malbers Animations, specifically for characters that utilize the MAnimal and MAnimalAIControl components for movement and behavior control.
· gameObjectFleeingFrom (SharedGameObject): The GameObject that the agent is attempting to flee from. This is the source of danger or threat that triggers the flee behavior.
· fleeDistance (SharedFloat): The distance at which the agent is considered to have successfully fled from the target. The flee behavior is considered successful when the agent's distance from the target exceeds this value.
· lookAheadDistance (SharedFloat): The distance to look ahead when calculating the flee direction. This influences how far ahead the agent plans its path when fleeing.
· OnAwake(): Initializes the MAnimal and MAnimalAIControl components. This method is called automatically when the script is first loaded.
· OnStart(): Prepares the flee behavior by verifying the agent's and AI control's availability, calculating the squared flee distance, and setting the initial flee target. It also initializes the hasMoved flag to false.
· OnUpdate(): Executes the flee logic each frame. It checks if the agent has successfully fled, is stuck, or needs to recalculate its flee path. Returns a TaskStatus indicating the success, failure, or ongoing execution of the flee task.
· Target(): Calculates the target position for fleeing. This is determined by moving in the opposite direction from the gameObjectFleeingFrom, influenced by the lookAheadDistance.
· SamplePosition(): Samples the NavMesh to find a valid position near the specified destination. This ensures the agent moves to a reachable location on the NavMesh.
· OnEnd(): Called when the flee task ends. Stops the agent's movement if AI control is available.
· IsAnimalAlive(): Checks if the agent is alive by verifying the MAnimal component's state is not Death.
· OnReset(): Resets the public variables to their default values. This method is called when the task is reset, preparing it for re-execution.
This class is intended for use within a Behavior Designer task, enabling dynamic flee behavior in agents equipped with Malbers Animations components. It requires the agent to have a MAnimal component for state checking and an MAnimalAIControl component for AI-driven movement. The flee behavior is triggered by a perceived threat, causing the agent to move away from the gameObjectFleeingFrom to a safer location.
The Follow class is a custom task for use within the Behavior Designer framework, designed to enable agents to follow a specified target using Unity's NavMesh. This class integrates with Malbers Animations , allowing characters with MAnimal and MAnimalAIControl components to follow targets dynamically, adjusting their speed and stopping distance based on the target's movement and distance.
· gameObjectToFollow (SharedGameObject): The GameObject that the agent will follow. This target can be any GameObject in the scene, including other agents or player characters.
· useAnimalStopDistance (SharedBool): Determines whether the agent uses the stop distance defined in the MAnimalAIControl component or a custom distance specified in the moveDistance field.
· moveDistance (SharedFloat): The distance from the target at which the agent starts moving. This field is used only if useAnimalStopDistance is set to false.
· OnAwake(): Initializes the MAnimal and MAnimalAIControl components. This method is called automatically when the script is first loaded.
· OnStart(): Prepares the follow behavior by verifying the agent's and AI control's availability, and the target's presence and state. It also calculates the initial separation distance and stores the original speed index of the agent.
· OnUpdate(): Executes the follow logic each frame. It checks if the target has moved and updates the agent's destination and speed accordingly. Returns a TaskStatus indicating the ongoing execution of the follow task.
· SetSpeed(float): Dynamically adjusts the agent's speed based on the change in distance to the target. This method increases or decreases the speed index or toggles sprinting to close the distance to the target more effectively.
· OnEnd(): Called when the follow task ends. Resets the agent's speed to its original index and stops its movement.
· IsAnimalAlive(): Checks if the agent is alive by verifying the MAnimal component's state is not Death.
· IsAnimalFollowedAlive(): Checks if the target animal (if applicable) is alive. If the target is not an animal (e.g., a vehicle), the method returns true, allowing the follow behavior to proceed.
· OnReset(): Resets the public variables to their default values. This method is called when the task is reset, preparing it for re-execution.
This class is intended for use within a Behavior Designer task, enabling dynamic follow behavior in agents equipped with Malbers Animations components. It requires the agent to have a MAnimal component for state checking and an MAnimalAIControl component for AI-driven movement. The follow behavior is adaptable, allowing agents to follow targets at a configurable distance and adjust their speed based on the target's movement.
The GameObjectToAnimal class is a specialized action within the Behavior Designer Malbers package, designed to convert a GameObject reference into an MAnimal reference. This class facilitates the interaction between generic GameObjects and specific animal behaviors controlled by the Malbers Animations system, enabling dynamic behavior assignment and manipulation in Unity's game development environment.
· gameObjectToConvert (SharedGameObject): This field holds the reference to the GameObject intended for conversion into an MAnimal. The GameObject should ideally have an MAnimal component attached to it for successful conversion.
· animal (SharedAnimal): This field is used to store the resulting MAnimal reference after conversion. It is marked as a required field, indicating that the conversion process aims to populate this field with a valid MAnimal instance.
· OnUpdate(): The method is the core of the GameObjectToAnimal class, where the conversion process takes place. The method performs the following steps:
1. Checks if the gameObjectToConvert field is null. If it is, the method returns TaskStatus.Failure, indicating that the conversion cannot proceed without a valid GameObject reference.
2. Attempts to retrieve an MAnimal component from the gameObjectToConvert using the TryGetComponent method. If successful, the MAnimal component is assigned to the animal field, and the method returns TaskStatus.Success, indicating a successful conversion.
3. If the TryGetComponent call does not find an MAnimal component, the method returns TaskStatus.Failure, indicating that the specified GameObject does not contain an MAnimal component and cannot be converted.
· OnReset(): The method is responsible for resetting the class's fields to their default states. This includes setting both the gameObjectToConvert and animal fields to null. This method ensures that the action can be reused cleanly in subsequent operations or behavior trees.
The GameObjectToAnimal class is used within Behavior Designer tasks to dynamically convert GameObjects into MAnimal references. This functionality is particularly useful in scenarios where a behavior tree needs to operate on specific animal behaviors but only has access to generic GameObject references. By converting these GameObjects into MAnimal references, the behavior tree can then access and manipulate the animal-specific properties and methods provided by the Malbers Animations system.
This class streamlines the process of integrating generic Unity GameObjects with the specialized Malbers Animations framework, enhancing the flexibility and dynamism of behavior trees in game development projects.
The GetSpeed class is a custom task for use within the Behavior Designer framework, designed to retrieve and expose the current speed information of an animal character controlled by the Malbers Animations system. This class is utilized within Unity's Behavior Designer to facilitate the dynamic adjustment of behavior trees based on the movement state of the animal.
· returnedSpeedSet (SharedString): Holds the name of the current Speed Set being used by the animal. Speed Sets in Malbers Animations define different sets of movement speeds and animations, such as walking, trotting, and running.
· returnedSpeedIndex (SharedInt): Stores the current Speed Index of the animal. The Speed Index indicates the specific speed within the current Speed Set, with higher indices typically representing faster movement speeds.
· returnIsSprint (SharedBool): Indicates whether the animal is currently sprinting. Sprinting is a state that usually represents the animal moving at its maximum speed.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the GameObject to which this script is attached. This method ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks if the animal reference is valid. If not, it returns TaskStatus.Failure, indicating that the task cannot proceed without a valid MAnimal component.
2. Retrieves the name of the current Speed Set from the animal component and stores it in returnedSpeedSet.
3. Retrieves the current Speed Index from the animal component and stores it in returnedSpeedIndex.
4. Checks if the animal is sprinting and stores the result in returnIsSprint.
5. Returns TaskStatus.Success, indicating that the speed information has been successfully retrieved and stored.
· OnReset(): Resets the serialized fields to their default values. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The GetSpeed class is used within Behavior Designer trees to dynamically adjust the behavior of animal characters based on their current speed and movement state. By exposing the animal's speed information, this class allows other tasks within the behavior tree to make informed decisions, such as changing the animal's behavior when it starts or stops sprinting or adjusting the distance to a target based on the animal's speed. This functionality enhances the realism and responsiveness of animal characters in games and simulations developed with Unity and the Malbers Animations system.
The GetStance class is a custom task for use within the Behavior Designer framework, designed to retrieve the current stance of an animal character controlled by the Malbers Animations system. This class is utilized within Behavior Designer to facilitate the dynamic adjustment of behavior trees based on the stance state of the animal.
· returnedStanceId (SharedStanceID): This field is used to store the ID of the stance that the animal is currently in. The stance ID is a unique identifier for each stance available in the Malbers Animations system, allowing for specific behaviors to be triggered based on the animal's stance.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the GameObject to which this script is attached. This method ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks if the animal reference is valid. If not, it returns TaskStatus.Failure, indicating that the task cannot proceed without a valid MAnimal component.
2. Retrieves the ID of the current active stance from the animal component and stores it in returnedStanceId.
3. Returns TaskStatus.Success, indicating that the stance ID has been successfully retrieved and stored.
· OnReset(): Resets the returnedStanceId field to its default state. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The GetStance class is used within Behavior Designer trees to dynamically adjust the behavior of animal characters based on their current stance. By exposing the animal's stance information, this class allows other tasks within the behavior tree to make informed decisions, such as changing the animal's behavior when it enters a specific stance or adjusting the animal's movement based on its stance. This functionality enhances the realism and responsiveness of animal characters in games and simulations developed with Unity and the Malbers Animations system.
The GetStat class is a custom task for use within the Behavior Designer framework, designed to retrieve and expose various statistics of an animal character controlled by the Malbers Animations system. This class is utilized within Unity's Behavior Designer to facilitate the dynamic adjustment of behavior trees based on the statistical state of the animal.
· statId (SharedStatID): This field specifies the ID of the statistic that you want to retrieve. The ID should correspond to one of the statistics defined in the Malbers Animations system.
· returnedStatValue (SharedFloat): Stores the current value of the specified statistic. This value reflects the current state of the statistic, such as health or stamina.
· returnedMaxStatValue (SharedFloat): Holds the maximum possible value of the specified statistic. This value is useful for calculating percentages or ratios, such as the current health percentage of the animal.
· returnedIsEnabled (SharedBool): Indicates whether the specified statistic is currently active or enabled. Some statistics may be temporarily disabled under certain conditions.
· returnedIsImmune (SharedBool): Specifies whether the specified statistic is currently immune to changes. For example, an animal might be temporarily immune to damage.
· OnAwake(): Initializes the class by obtaining a reference to the Stats component on the GameObject to which this script is attached. This method ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks if the stats reference is valid. If not, it returns TaskStatus.Failure, indicating that the task cannot proceed without a valid Stats component.
2. Retrieves the current value, maximum value, active status, and immune status of the specified statistic from the stats component and stores them in the corresponding fields.
3. Returns TaskStatus.Success, indicating that the statistic information has been successfully retrieved and stored.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The GetStat class is used within Behavior Designer trees to dynamically adjust the behavior of animal characters based on their current statistical states. By exposing the animal's statistic information, this class allows other tasks within the behavior tree to make informed decisions, such as changing the animal's behavior based on its health or stamina. This functionality enhances the realism and responsiveness of animal characters in games and simulations developed with Unity and the Malbers Animations system.
The GetState class is a custom task for use within the Behavior Designer framework, designed to retrieve the current state ID of an animal character controlled by the Malbers Animations system. This class is utilized within Behavior Designer to facilitate the dynamic adjustment of behavior trees based on the state of the animal.
· returnedStateId (SharedStateID): This field is used to store the ID of the state that the animal is currently in. The state ID is a unique identifier for each state available in the Malbers Animations system, allowing for specific behaviors to be triggered based on the animal's state.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the GameObject to which this script is attached. This method ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Retrieves the ID of the current active state from the animal component and stores it in returnedStateId.
2. Returns TaskStatus.Success, indicating that the state ID has been successfully retrieved and stored.
· OnReset(): Resets the returnedStateId field to its default state. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The GetState class is used within Behavior Designer trees to dynamically adjust the behavior of animal characters based on their current state. By exposing the animal's state information, this class allows other tasks within the behavior tree to make informed decisions, such as changing the animal's behavior when it enters a specific state or adjusting the animal's movement based on its state. This functionality enhances the realism and responsiveness of animal characters in games and simulations developed with Unity and the Malbers Animations system.
The GetWeapon class is a custom task for use within the Behavior Designer framework, designed to retrieve information about the currently equipped weapon of a character controlled by the Malbers Animations system. This class is utilized within Unity's Behavior Designer to facilitate the dynamic adjustment of behavior trees based on the weapon state of the character.
· returnedWeapon (SharedGameObject): Stores the GameObject of the currently equipped weapon. This allows other tasks within the behavior tree to interact with the weapon, such as performing actions or checking its state.
· returnedWeaponAmmo (SharedInt): Holds the amount of ammunition currently in the weapon. This is particularly relevant for ranged weapons that have a limited capacity before needing to reload.
· returnedInventoryAmmo (SharedInt): Represents the total ammunition available in the character's inventory for the equipped weapon. This includes the ammunition currently in the weapon and any extra ammunition that can be used to reload.
· OnAwake(): Initializes the class by obtaining a reference to the MWeaponManager component on the GameObject to which this script is attached. This method ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Retrieves the GameObject of the currently equipped weapon from the weaponManager component and stores it in returnedWeapon.
2. If a weapon is equipped, it checks if the weapon implements the IShootableWeapon interface to determine if it is a ranged weapon.
3. For ranged weapons, it retrieves and stores the current ammunition in the weapon (returnedWeaponAmmo) and the total ammunition available in the inventory (returnedInventoryAmmo).
4. If no weapon is equipped or the equipped weapon is not a ranged weapon, it sets both ammunition values to 0.
5. Returns TaskStatus.Success, indicating that the weapon information has been successfully retrieved and stored.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The GetWeapon class is used within Behavior Designer trees to dynamically adjust the behavior of characters based on their currently equipped weapon and its state. By exposing the weapon's information, this class allows other tasks within the behavior tree to make informed decisions, such as changing the character's behavior based on the type of weapon equipped, the amount of ammunition available or when a reload is needed, if the game designers does not enable auto reload. This functionality enhances the realism and responsiveness of characters in games and simulations developed with Unity and the Malbers Animations system.
The KeepInRange class is a custom task for use within the Behavior Designer framework, designed to maintain a character's position within a specified range of a target using Unity's NavMesh system. This class is particularly useful in scenarios where an Malbers Animation AI-controlled character needs to follow or maintain a strategic distance from another character or object.
· targetGameObject (SharedGameObject): The GameObject that the agent is seeking. This is the target object that the agent will attempt to stay within a certain range of.
· minDistance (SharedFloat): The minimum distance to keep from the target. This value defines how close the agent can get to the target.
· maxDistance (SharedFloat): The maximum distance to the target. This value defines how far the agent can be from the target.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the agent. This method ensures that the necessary components are available before the task starts executing.
· OnStart(): Performs initial checks and setups at the start of the task. It verifies the presence and state of the agent, the AI control component, and the target. It also calculates the initial destination based on the current position of the target and the specified range.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the state of the agent, the AI control component, and the target. If any of these checks fail, it returns TaskStatus.Failure.
2. Calculates the direction and distance to the target.
3. Determines the appropriate position based on the specified range and sets the AI control's destination to this position.
4. Returns TaskStatus.Running, indicating that the task is ongoing.
· Target(Vector3, float): Calculates the target position based on the current direction and distance to the target, taking into account the specified minimum and maximum distances.
· SamplePosition(ref Vector3): Attempts to find the nearest valid NavMesh position to the specified position. This method is used to ensure that the destination set for the AI control is reachable.
· OnEnd(): Called when the task ends. It stops the AI control's movement.
· IsAnimalAlive(): Checks if the agent's MAnimal component is not null and the agent is not in a death state.
· IsAnimalInRangeAlive(): Checks if the target's MAnimal component is not null and the target is not in a death state.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The KeepInRange class is used within Behavior Designer trees to control the movement of AI characters, ensuring they maintain a strategic position relative to a target. This functionality is essential for creating realistic and strategic AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The Meander class is a custom task for use within the Behavior Designer framework, designed to enable Malbers Animation AI-controlled characters to wander or meander within a radius towards a specified target using Unity's NavMesh system. This behavior is useful for creating natural and unpredictable movement patterns for characters in a game environment.
· targetTransform (SharedTransform): The target towards which the agent should meander. This transform acts as a focal point for the wandering behavior.
· minPauseDuration (SharedFloat): The minimum length of time, in seconds, that the agent should pause upon reaching a destination before moving again. This adds variability to the meandering behavior.
· maxPauseDuration (SharedFloat): The maximum length of time, in seconds, that the agent should pause upon reaching a destination before moving again. This value, together with minPauseDuration, defines the range of possible pause durations.
· meanderRadius (SharedFloat): The radius within which the agent should meander around the target. This defines the area of movement for meandering behavior.
· targetBias (float): A value between 0 and 1 that biases the agent's movement towards the target. A higher value results in the agent moving closer to the target, while a lower value encourages more random wandering within the specified radius.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the agent. This method ensures that the necessary components are available before the task starts executing.
· OnStart(): Performs initial checks and setups at the start of the task. It verifies the presence and state of the agent, the AI control component, and the target transform. It also calculates the initial destination based on the target transform and the specified meander radius.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the state of the agent, the AI control component, and the target transform. If any of these checks fail, it returns TaskStatus.Failure.
2. Determines whether the agent has arrived at its destination and, if so, whether it should pause or move to a new destination.
3. Calculates a new destination if necessary and sets the AI control's destination to this position.
4. Returns TaskStatus.Running, indicating that the task is ongoing.
· Target(): Generates a random position within a sphere towards the target, then finds the closest point on the NavMesh. This method is used to calculate the next destination for the agent.
· IsAnimalAlive(): Checks if the agent's MAnimal component is not null and the agent is not in a death state.
· OnEnd(): Called when the task ends. It stops the AI control's movement.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The Meander class is used within Behavior Designer trees to control the movement of AI characters, allowing them to wander toward a target point in a natural and unpredictable manner. This functionality is essential for creating dynamic and engaging AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The MoveTowards class is a custom task for use within the Behavior Designer framework, designed to enable Malbers Animation AI-controlled characters to move towards a specified target without relying on Unity's NavMesh system. This class provides a straightforward approach to direct movement, making it suitable for scenarios where navigation meshes are not applicable or desired.
· targetObject (SharedGameObject): The GameObject that the agent is moving towards. This target object defines the destination for the agent's movement.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the agent. This method ensures that the necessary components are available before the task starts executing.
· OnStart(): Performs initial setups at the start of the task. It calculates the direction towards the target object and determines the stopping distance squared. It also initiates the movement of the agent towards the target by calling the Move method on the MAnimal component.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the presence of the necessary components and the target object. If any of these checks fail, it returns TaskStatus.Failure.
2. Determines whether the agent has arrived at its destination by comparing the squared distance to the target with the stopping distance squared. If the agent has arrived, it stops the agent and returns TaskStatus.Success.
3. Continues to move the agent towards the target by calling the Move method on the MAnimal component with the previously calculated direction vector.
· OnEnd(): Called when the task ends. It ensures that the agent stops moving by calling the Stop method on the MAnimalAIControl component.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The MoveTowards class is used within Behavior Designer trees to control the movement of AI characters, directing them towards a specified target. This functionality is essential for creating engaging AI behaviors in games and simulations developed with Unity and the Malbers Animations system, especially in environments where navigation meshes are not used or available.
The Patrol class is a custom task for use within the Behavior Designer framework, designed to enable Malbers Animation AI-controlled characters to patrol around a set of specified waypoints using Unity's NavMesh system. This task supports both sequential and random patrolling through the waypoints, providing flexibility for various gameplay scenarios.
· randomPatrol (SharedBool): Determines whether the agent should patrol the waypoints in a random order. If set to true, waypoints are selected randomly; otherwise, the agent patrols the waypoints in a sequential order.
· minPauseDuration (SharedFloat): The minimum length of time, in seconds, that the agent should pause upon arriving at a waypoint. This adds variability to the patrol behavior, making it more dynamic.
· maxPauseDuration (SharedFloat): The maximum length of time, in seconds, that the agent should pause upon arriving at a waypoint. This value, together with minPauseDuration, defines the range of possible pause durations.
· waypoints (SharedGameObjectList): A list of GameObjects representing the waypoints to move to. These waypoints define the patrol route for the agent.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the agent. This method ensures that the necessary components are available before the task starts executing.
· OnStart(): Performs initial setups at the start of the task. It calculates the closest waypoint to the agent's current position and sets it as the initial target. This method also initializes the waypointReachedTime to -1, indicating that the agent has not yet reached a waypoint.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the presence of the necessary components and the waypoints list. If any of these checks fail, it returns TaskStatus.Failure.
2. Determines whether the agent has arrived at the current waypoint and, if so, whether it should pause or move to the next waypoint.
3. Calculates the next waypoint based on the randomPatrol setting and sets the agent's destination to this waypoint.
· Target(): Calculates the target position based on the current waypoint index. This method is used to determine the destination for the agent's movement.
· SetDestination(Vector3, bool): Sets the destination for the agent's movement. This method uses the SamplePosition method to find the nearest valid NavMesh position to the specified destination and then instructs the aiControl to move the agent towards this position.
· SamplePosition(ref Vector3): Attempts to find the nearest valid NavMesh position to the specified position. This method is used to ensure that the destination set for the agent's movement is reachable.
· OnEnd(): Called when the task ends. It ensures that the agent stops moving by calling the Stop method on the MAnimalAIControl component.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
· IsAnimalAlive(): Checks if the agent's MAnimal component is not null and the agent is not in a death state.
· OnDrawGizmos(): Draws gizmos in the Unity Editor to visually represent the patrol waypoints. This method is useful for debugging and designing patrol routes.
The Patrol class is used within Behavior Designer trees to control the movement of AI characters, allowing them to patrol around a set of waypoints in either a sequential or random order. This functionality is essential for creating dynamic and engaging AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The PlayMode class is a custom task for use within the Behavior Designer framework, designed to control the activation of various modes on a Malbers Animation AI-controlled character using the Malbers Animations system. This class allows for the dynamic activation of modes such as actions, attacks, or abilities, with optional parameters for random selection, power level, and target alignment.
· modeId (SharedModeID): Identifies the mode to be activated on the animal controller. This ID corresponds to a specific mode defined in the Malbers Animations system.
· abilityId (SharedActionID): Specifies the ability to activate within the selected mode. This can be a specific ability by name or number, a random ability (ID = -99), or a command to cancel the current action (None ability).
· modePower (SharedInt): Defines the power level of the mode being activated. This can affect the mode's effectiveness or behavior, depending on how mode power is implemented in the specific mode.
· lookAtAlign (SharedBool): When enabled, the animal will quickly align its view towards the target before activating the mode. This is useful for modes that require the animal to face a specific direction, such as attacks.
· eyesTransform (SharedTransform): The transform component representing the animal's eyes or the point from which the animal should align its view towards the target.
· target (SharedGameObject): The target GameObject that the animal should look at when lookAtAlign is enabled.
· fieldOfView (float): The field of view angle (in degrees) within which the target must be for the animal to activate the mode. This allows for conditional activation based on the target's position relative to the animal's forward direction.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the agent. This ensures that the necessary components are available before the task starts execution.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Validates the presence of the necessary components, mode ID, and target (if lookAtAlign is enabled). Returns TaskStatus.Failure if any validations fail.
2. Checks if an ability ID is provided. If not, interrupts the current mode and returns TaskStatus.Success.
3. Determines whether the animal is already playing or preparing a mode. If so, interrupt the mode and returns TaskStatus.Running.
4. Attempts to activate the specified mode through the PlayModeProcess method. Returns TaskStatus.Success if the mode is successfully activated, otherwise returns TaskStatus.Failure.
· PlayModeProcess(): Attempts to activate the specified mode on the animal. This method handles the logic for aligning the animal towards the target (if required) and activating the mode with the specified ability and power level.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The PlayMode class is used within Behavior Designer trees to dynamically control the activation of modes on AI characters, enhancing the versatility and responsiveness of AI behaviors in games and simulations developed with Unity and the Malbers Animations system. This functionality is particularly useful for implementing complex behaviors such as combat, interaction, or environmental interaction.
The Pursue class is a custom task for use within the Behavior Designer framework, enabling Malbers Animation AI-controlled characters to pursue a target using Unity's NavMesh system. This class incorporates predictive logic to anticipate the target's future position based on its current velocity, enhancing the realism and effectiveness of the pursuit behavior.
· pursedGameObject (SharedGameObject): The GameObject that the agent is pursuing. This target is the focus of the pursuit behavior.
· predictionDistance (SharedFloat): Defines how far ahead of the target the agent should predict when calculating the interception point. Lower values result in less prediction.
· predictionMultiplier (SharedFloat): A multiplier used to adjust the prediction calculation. This value influences how the prediction scales with the distance and speed of the target.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the agent.
· OnStart(): Prepares the pursuit behavior by validating the presence of necessary components and the target GameObject. It also calculates the initial target position for prediction purposes.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It checks the validity of the agent, the AI control, and the target, and updates the pursuit target based on the predictive logic. The method returns TaskStatus.Running while the pursuit is ongoing and TaskStatus.Success once the target has been reached.
· Target(): Calculates the predicted future position of the target based on its current velocity and the specified prediction parameters. This method ensures that the agent aims for where the target is going to be, rather than where it currently is.
· SetDestination(Vector3, bool): Sets the destination for the agent's movement. This method uses the SamplePosition method to find the nearest valid NavMesh position to the specified destination and then instructs the aiControl to move the agent towards this position.
· SamplePosition(ref Vector3): Attempts to find the nearest valid NavMesh position to the specified position. This method is used to ensure that the destination set for the agent's movement is reachable.
· IsAnimalAlive(): Checks if the agent's MAnimal component is not null and the agent is not in a death state. This method ensures that the pursuit behavior only runs if the agent is alive.
· IsAnimalPursuedAlive(): Checks if the pursued target's MAnimal component is not null and the target is not in a death state. This method allows for conditional logic based on the state of the pursued target.
· OnEnd(): Called when the task ends. It ensures that the agent stops moving by calling the Stop method on the MAnimalAIControl component.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The Pursue class is used within Behavior Designer trees to implement pursuit behavior in AI characters, allowing them to dynamically follow and intercept moving targets. This functionality is crucial for creating engaging and challenging AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The QuickAlign class is a custom task for use within the Behavior Designer framework, designed to quickly align the rotation of a Malbers Animation AI-controlled character (animal) with that of another object. This class is useful for scenarios where an AI character needs to face the same direction as another object within a very short duration.
· objectToAlignWith (SharedGameObject): The GameObject with which the AI character's rotation should be aligned. This object serves as the reference for the alignment process.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the AI character. This setup ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the presence of the animal component and the objectToAlignWith. If either is missing, the method returns TaskStatus.Failure.
2. Initiates a coroutine using MTools.AlignTransform_Rotation to align the AI character's rotation with that of the specified object.
3. Returns TaskStatus.Success once the alignment coroutine has been started, indicating that the alignment process is underway.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The QuickAlign class is used within Behavior Designer trees to implement quick alignment behavior in AI characters. This functionality is particularly useful in scenarios where an AI character needs to quickly face the same direction as another object, such as aligning with a target before initiating an attack or interaction. This class enhances the responsiveness and realism of AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The RotateTowards class is a custom task for use within the Behavior Designer framework, crafted to enable Malbers Animation AI-controlled characters to rotate towards a specified target. This functionality is crucial for creating immersive and interactive AI behaviors, such as facing an opponent during combat or turning towards an interactive object.
· targetObject (SharedGameObject): The GameObject that the AI character should rotate to face. This target serves as the focal point for the rotation action.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the AI character. This ensures that the necessary components are available before the task starts execution.
· OnUpdate(): The core method of the class, OnUpdate, is executed every frame when the task is active. It performs the following operations:
1. Validates the presence of the animal component and the targetObject. If either is missing or if the animal is in a death state, the method returns TaskStatus.Failure.
2. Initiates a coroutine using Malbers Animation’s AlignLookAtTransform to rotate the AI character's transform to face the target object.
3. Returns TaskStatus.Success once the rotation coroutine has been started, indicating that the rotation process is underway.
· IsAnimalAlive(): Checks if the AI character's MAnimal component is not null and the character is not in a death state. This method ensures that the rotation behavior only runs if the AI character is alive.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The RotateTowards class is utilized within Behavior Designer trees to implement rotation behavior in AI characters, allowing them to dynamically face targets. This functionality enhances the realism and interactivity of AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The Seek class is a custom task for use within the Behavior Designer framework, designed to enable Malbers Animation AI-controlled characters to seek a specified target using Unity's NavMesh system. This class is essential for creating AI behaviors that involve moving towards a point of interest, such as a player character, an item, or a location within the game world.
· targetGameObject (SharedGameObject): The GameObject that the agent is programmed to seek. This is the primary target for the seeking behavior.
· lookAheadDistance (SharedFloat): Specifies the distance to look ahead for a destination. This parameter can be used to adjust how far in advance the AI plans its path towards the target.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the AI character. This setup ensures that the necessary components are available before the task starts executing.
· OnStart(): Prepares the seeking behavior by validating the presence of necessary components and the target GameObject. If the target is valid, it sets the initial destination for the AI character to start moving towards the target.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Validates the presence of the animal component, the aiControl, and the targetGameObject. If any of these are missing or if the animal is in a death state, the method returns TaskStatus.Failure.
2. Checks if the AI character has arrived at the target destination. If so, it stops the AI control and returns TaskStatus.Success.
3. Continuously updates the destination to the current position of the target GameObject, ensuring that the AI character follows the target if it moves.
· OnEnd(): Called when the task ends. It ensures that the AI character stops moving by calling the Stop method on the MAnimalAIControl component.
· IsAnimalAlive(): Checks if the AI character's MAnimal component is not null and the character is not in a death state. This method ensures that the seeking behavior only runs if the AI character is alive.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The Seek class is used within Behavior Designer trees to implement seeking behavior in AI characters, allowing them to move towards targets dynamically. This functionality is crucial for creating engaging and challenging AI behaviors in games and simulations developed with Unity and the Malbers Animations system.
The SetSpeed class is a custom task for use within the Behavior Designer framework, designed to dynamically adjust the speed of Malbers Animation AI-controlled characters based on predefined speed sets. This functionality is crucial for creating varied and realistic AI behaviors, such as transitioning between walking, trotting, and sprinting, depending on the context within the game.
· speedSet (SharedString): The name of the Speed Set to be used. Speed Sets are predefined groups of speed configurations on the MAnimal component that dictate how fast the character moves.
· speedIndex (SharedInt): The index within the selected Speed Set to activate. This allows for fine-grained control over the character's speed by selecting specific speeds within a set.
· sprint (SharedBool): A boolean indicating whether the character should sprint. Sprinting typically represents the fastest mode of movement available to the character.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the AI character. This ensures that the necessary components are available before the task starts execution.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the presence of the animal component. If it is missing, the method returns TaskStatus.Failure.
2. Sets the active Speed Set and Speed Index on the MAnimal component based on the speedSet and speedIndex fields. This adjusts the character's speed according to the specified configuration.
3. Sets the sprinting state of the character based on the sprint field. This allows for dynamic control over whether the character is sprinting.
4. Returns TaskStatus.Success to indicate that the speed has been successfully updated.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The SetSpeed class is used within Behavior Designer trees to implement dynamic speed control in AI characters. This functionality allows for the creation of more lifelike and adaptable AI behaviors in games and simulations developed with Unity and the Malbers Animations system. By adjusting the speed of AI characters based on context, developers can enhance the realism and responsiveness of their AI.
The SetStance class is a custom task for use within the Behavior Designer framework, designed to change the stance of Malbers Animation AI-controlled characters. Stances are predefined states or modes that an AI character can enter, which may affect its behavior, animations, and abilities. This functionality is essential for creating diverse and dynamic AI behaviors that respond to different situations in the game.
· stanceId (SharedStanceID): The identifier for the stance that the AI character should activate. This ID corresponds to a specific stance defined in the MAnimal component.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the AI character. This setup ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the presence of the animal component and the validity of the stanceId. If either is missing, the method returns TaskStatus.Failure.
2. Activates the specified stance on the MAnimal component using the Stance_Activate method and the stanceId value. This changes the character's current stance to the specified one.
3. Returns TaskStatus.Success to indicate that the stance has been successfully activated.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The SetStance class is used within Behavior Designer trees to implement stance changes in AI characters. This functionality allows for the creation of more complex and varied AI behaviors in games and simulations developed with Unity and the Malbers Animations system. By dynamically changing stances, developers can simulate different behaviors and reactions from AI characters, enhancing the depth and realism of their game's AI.
The SetStat class is a custom task for use within the Behavior Designer framework, designed to modify the statistics (stats) of Malbers Animation AI-controlled characters. This class allows for dynamic adjustments to stats such as health, stamina, or any custom stat defined within the game, providing a flexible system for influencing AI behavior and attributes.
· statId (SharedStatID): The identifier for the stat that you want to update. This ID corresponds to a specific stat defined in the Stats component.
· statOption (StatOption): The operation you want to perform on the stat. This can include actions such as adding, subtracting, setting a specific value, or toggling a stat's enabled state.
· minValue (SharedFloat): The minimum value to use when performing the action on the stat. This is used when the action involves adding or subtracting a random value.
· maxValue (SharedFloat): The maximum value to use when performing the action on the stat. This is used in conjunction with minValue to define a range of possible values.
· enable (SharedBool): Specifies whether to enable the stat. This is relevant for operations that involve enabling or disabling a stat.
· OnAwake(): Initializes the class by obtaining a reference to the Stats component on the AI character. This ensures that the necessary components are available before the task starts execution.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs the following operations:
1. Checks the presence of the stats component and the validity of the statId. If either is missing, the method returns TaskStatus.Failure.
2. Calls the ModifyStat method with the specific stat obtained from the Stats component using the statId. The success or failure of this operation determines the return value of OnUpdate.
· ModifyStat(Stat): Attempts to modify the specified stat based on the statOption, minValue, maxValue, and enable fields. The method handles different types of modifications, including setting specific values, adding/subtracting random values within a range, and toggling the stat's enabled state.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The SetStat class is used within Behavior Designer trees to dynamically adjust the stats of AI characters. This functionality allows for the creation of complex and responsive AI behaviors in games and simulations developed with Unity and the Malbers Animations system. By modifying stats based on game events or AI decisions, developers can simulate a wide range of effects, such as damage, healing, stamina depletion, and more, enhancing the depth and interactivity of their game's AI.
The SetState class is a custom task for use within the Behavior Designer framework, designed to control the state of Malbers Animation AI-controlled characters. This class provides functionality to set, activate, enable, disable, or force states on characters, allowing for dynamic behavior changes in response to game events or AI decisions.
· stateId (SharedStateID): The identifier for the state you want to set or play. This ID corresponds to a specific state defined in the MAnimal component.
· action (StateAction): Specifies the action to perform with the state. Actions include activating, allowing exit, forcing activation, enabling, disabling, and setting exit status.
· coolDown (SharedFloat): Specifies how long to wait before being able to restart the state. This cooldown period prevents rapid toggling of states, ensuring more natural behavior transitions.
· OnAwake(): Initializes the class by obtaining a reference to the MAnimal component on the AI character. This setup ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs operations based on the specified action:
o Activate: Activates the specified state if it is not already active.
o AllowExit: Allows the active state to exit if it matches the specified state ID.
o ForceActivate: Forces the activation of the specified state, overriding any current state.
o Enable: Enables the specified state, allowing it to be activated.
o Disable: Disables the specified state, preventing it from being activated.
o SetExitStatus: Sets the exit status of the specified state, influencing how the state concludes.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The SetState class is used within Behavior Designer trees to dynamically control the states of AI characters. This functionality allows for the creation of complex and responsive AI behaviors in games and simulations developed with Unity and the Malbers Animations system. By manipulating states based on game events, AI decisions, or player interactions, developers can simulate a wide range of behaviors and reactions, enhancing the depth and realism of their game's AI.
The SetWeapon class is a custom task for use within the Behavior Designer framework, designed to manage weapon states and actions for Malbers Animation AI-controlled characters. This class provides functionality to equip, holster, reload, store, and unequip weapons dynamically, allowing for realistic and responsive AI behaviors in combat scenarios.
· weaponAction (WeaponAction): Specifies the action to perform with the weapon. Actions include drawing/holstering, equipping, reloading, storing, and unequipping the weapon.
· weapon (SharedGameObject): The prefab of the weapon to equip. This is the game object that represents the weapon in the game world.
· holsterId (SharedHolsterID): The identifier for the holster from which to equip the weapon. This allows for specific weapons to be drawn from specific holsters.
· ignoreDrawStore (SharedBool): Specifies whether to ignore draw and store weapon animations. This can be used to instantly change the weapon state without playing the corresponding animations.
· OnAwake(): Initializes the class by obtaining a reference to the MWeaponManager component on the AI character. This setup ensures that the necessary components are available before the task starts executing.
· OnUpdate(): The core method of the class, OnUpdate, is called every frame when the task is active. It performs operations based on the specified weaponAction:
o EquipWeapon: Equips the specified weapon if it is not already equipped. (Available when within Weapon Manager, Use External is enabled)
o DrawHolster: Holsters the currently equipped weapon and equips a new weapon from the specified holster. (Available when within Weapon Manager, User Hosters is enabled).
o StoreWeapon: Stores the currently equipped weapon, optionally ignoring the store animation.
o Reload: Reloads the currently equipped weapon.
o UnequipWeapon: Unequips the currently equipped weapon.
· OnReset(): Resets the serialized fields to their default states. This method is called when the task is reset, ensuring that old data does not persist between task executions.
The SetWeapon class is used within Behavior Designer trees to dynamically control the weapons of Malbers Animation AI characters. This functionality allows for the creation of complex and responsive AI behaviors in combat scenarios within games and simulations developed with Unity and the Malbers Animations system. By managing weapon states and actions based on game events, AI decisions, or player interactions, developers can simulate a wide range of combat behaviors, enhancing the depth and realism of their game's AI.
The Wander class is a custom task for use within the Behavior Designer framework, designed to enable Malbers Animation AI-controlled characters to move randomly using the Unity NavMesh system. This class allows characters to simulate wandering behavior within a specified area, making their movements appear more natural and less predictable.
· minWanderDistance (SharedFloat): The minimum distance ahead of the current position to look ahead for a destination. This ensures that the character does not make too small movements.
· maxWanderDistance (SharedFloat): The maximum distance ahead of the current position to look ahead for a destination. This limits how far the character can move in a single wandering action.
· maxWanderDegrees (SharedFloat): The maximum number of degrees that the agent can turn when wandering. A smaller value results in straighter paths, while a larger value allows for more varied movement. When stuck this value is ignored and a 180-degree movement is attempted.
· minPauseDuration (SharedFloat): The minimum length of time that the agent should pause when arriving at a destination. This adds variability to the wandering behavior.
· maxPauseDuration (SharedFloat): The maximum length of time that the agent should pause when arriving at a destination. This, combined with minPauseDuration, defines the range of possible pause durations.
· useWanderRegion (SharedBool): Specifies whether the wandering area should be limited to a specific region, defined by wanderRegionCenter and wanderRadius.
· wanderRegionCenter (SharedGameObject): The center of the wander area. This is used in conjunction with wanderRadius to define a circular wander area.
· wanderRadius (SharedFloat): The radius of the wander circle. This defines how far from the wanderRegionCenter the character can wander.
· OnAwake(): Initializes the class by obtaining references to the MAnimal and MAnimalAIControl components on the AI character.
· OnStart(): Prepares the character for wandering by determining an initial target destination and setting up the AI control to move towards it.
· OnUpdate(): The core method of the class, called every frame when the task is active. It checks if the character has arrived at its destination and, if so, determines whether to pause or to calculate a new destination. The method ensures continuous wandering behavior.
· Target(): Calculates a new target destination based on the current position, minWanderDistance, maxWanderDistance, and maxWanderDegrees. It also considers useWanderRegion and wanderRadius if a specific wander area is defined.
· Destination(float, ref Vector3, out ref Vector3): A helper method used by Target to calculate a potential destination based on a given direction and distance. It checks if the destination is valid and within the defined wander area.
· SamplePosition(Vector3): Checks if a given position is on the NavMesh, ensuring that the character can physically reach the destination.
· IsAnimalAlive(): Checks if the MAnimal component is active and not in a death state, ensuring that the character is alive and can perform wandering behavior.
· OnDrawGizmos(): Used in the Unity Editor to visually represent the wander area when useWanderRegion is enabled.
· OnEnd(): Called when the wandering behavior ends, typically to stop the character's movement.
· OnReset(): Resets the serialized fields to their default values, preparing the class for reuse or ensuring clean starts between uses.
The Wander class is used within Behavior Designer trees to simulate random movement behavior for Malbers Animation AI characters. By allowing characters to move unpredictably within a defined area, developers can create more dynamic and engaging AI behaviors in games and simulations developed with Unity and the Malbers Animations system.