#include <BTDecorator_RandomChance.h>
UBTDecorator_RandomChance is a decorator that adds randomness to the execution of its child node. It calculates a raw condition value based on a random chance and a maximum chance specified by the user.
◆ UBTDecorator_RandomChance()
| UBTDecorator_RandomChance::UBTDecorator_RandomChance |
( |
| ) |
|
11{
12 NodeName = TEXT("Random Chance");
13}
◆ CalculateRawConditionValue()
| bool UBTDecorator_RandomChance::CalculateRawConditionValue |
( |
UBehaviorTreeComponent & | OwnerComp, |
|
|
uint8 * | NodeMemory ) const |
|
overrideprotectedvirtual |
16{
18 SCOPE_CYCLE_COUNTER(STATGROUP_AIToolKit_Behaviors);
19 SCOPE_CYCLE_COUNTER(STATGROUP_AIToolKit_Decorators);
20 return 0 == FMath::RandRange(0, (
MaxChance - 1));
21}
int32 MaxChance
Definition BTDecorator_RandomChance.h:28
virtual bool CalculateRawConditionValue(UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory) const override
Definition BTDecorator_RandomChance.cpp:15
◆ GetStaticDescription()
| FString UBTDecorator_RandomChance::GetStaticDescription |
( |
| ) |
const |
|
overrideprotectedvirtual |
24{
25 FString Description;
26 Description += FString::Printf(TEXT(
"\n 1 in %i Chance"),
MaxChance);
27 return Description;
28}
◆ MaxChance
| int32 UBTDecorator_RandomChance::MaxChance = 1 |
|
protected |
The documentation for this class was generated from the following files:
- T:/Unreal/Unreal Projects/SpaceAdventure52/SpaceAdventure/Plugins/AIToolKit/Source/AIToolKit/Public/Behavior/Decotators/BTDecorator_RandomChance.h
- T:/Unreal/Unreal Projects/SpaceAdventure52/SpaceAdventure/Plugins/AIToolKit/Source/AIToolKit/Private/Behavior/Decotators/BTDecorator_RandomChance.cpp