using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BehaviorTreeSlayer
{
    public class RandomCall : ConditionalNode
    {
        [OutField]
        public double Rand=0.2;
        [OutField]
        public double Freq=1;
        [ShowMe]
        double timer;
        public override bool Check(double dt, object args)
        {
            timer += dt;
            if (timer > Freq)
            {
                timer = 0;
                IsConditionOK = (args as BehaviorTree).MyRandom.NextDouble() < Rand;
            }
            return base.Check(dt, args);
        }
    }
}