コード例 #1
0
ファイル: IterateNode.cs プロジェクト: 95D/PuppetTheater
 protected override bool OnExecute(BehaviorContext context)
 {
     for (int i = 0; i < range; i++)
     {
         child.Execute(context);
     }
     return(true);
 }
コード例 #2
0
ファイル: IfNode.cs プロジェクト: 95D/PuppetTheater
 protected override bool OnExecute(BehaviorContext context)
 {
     if (inference(context))
     {
         return(thenChild.Execute(context));
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: UntilNode.cs プロジェクト: 95D/PuppetTheater
        protected override bool OnExecute(BehaviorContext context)
        {
            bool isSuccess = false;

            while (inference(context))
            {
                untilChild.Execute(context);
                isSuccess = true;
            }
            return(isSuccess);
        }
コード例 #4
0
ファイル: StochasticNode.cs プロジェクト: 95D/PuppetTheater
        protected override bool OnExecute(BehaviorContext context)
        {
            var randGen = new Random();

            if (randGen.NextDouble() > threshold)
            {
                return(child.Execute(context));
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
ファイル: ForceSuccessNode.cs プロジェクト: 95D/PuppetTheater
 protected override bool OnExecute(BehaviorContext context)
 {
     child.Execute(context);
     return(true);
 }
コード例 #6
0
ファイル: InvertNode.cs プロジェクト: 95D/PuppetTheater
 protected override bool OnExecute(BehaviorContext context)
 {
     return(!child.Execute(context));
 }