Exemplo n.º 1
0
        static Tortoise()
        {
            const float MinHidingTime = 5f;
            const float MaxHidingTime = 10f;

            TortoiseTreeRoot =
                BT.Selector("Tortoise Brain",
                            // Tortoise hide instead of fleeing, fixed time to block pointless flee interruptions
                            BT.If("Try Hide", x => (x.Alertness > Animal.FleeThreshold, $"{x.Alertness} > {Animal.FleeThreshold}"),
                                  Brain.Anim(AnimalState.Hiding, true, _ => RandomUtil.Range(MinHidingTime, MaxHidingTime))),
                            LandAnimalBrain.LandAnimalTreeRoot);

            Brain <Tortoise> .SharedBehavior = TortoiseTreeRoot;
        }