Ultraworked with [Sisyphus](https://github.com/code-yeonggu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
26 lines
774 B
C#
26 lines
774 B
C#
using System;
|
|
using UnityEngine;
|
|
using Unity.Behavior;
|
|
using Unity.Properties;
|
|
using Condition = Unity.Behavior.Condition;
|
|
|
|
namespace Colosseum.AI.BehaviorActions.Conditions
|
|
{
|
|
/// <summary>
|
|
/// 무작위 확률로 성공/실패를 반환합니다.
|
|
/// </summary>
|
|
[Serializable, GeneratePropertyBag]
|
|
[NodeDescription(name: "Random Chance", story: "Random chance of [Chance] percent", category: "Utility")]
|
|
public partial class RandomChanceCondition : Condition
|
|
{
|
|
[SerializeReference]
|
|
public BlackboardVariable<float> Chance = new BlackboardVariable<float>(50f);
|
|
|
|
public override bool IsTrue()
|
|
{
|
|
float roll = UnityEngine.Random.Range(0f, 100f);
|
|
return roll <= Chance.Value;
|
|
}
|
|
}
|
|
}
|