Beispiel #1
0
        private ITicker _MakeItemStrategy()
        {
            var index   = 0;
            var builder = new Regulus.BehaviourTree.Builder();

            var timeTrigger = new TimeTriggerStrategy(10f);

            var node = builder
                       .Sequence()
                       .Action(timeTrigger.Tick)
                       .Action((delta) => timeTrigger.Reset(10f))
                       .Action(_ToMake)
                       .Action(() => new WaitSecondStrategy(3), t => t.Tick, t => t.Start, t => t.End)
                       .Action((delta) => _GetRandomIndex(0, 4, out index))
                       .Selector()
                       .Sequence()
                       .Action((delta) => _If(index == 0))
                       .Action((delta) => _CheckItemAmount("Axe1", (count) => count < 2))
                       .Action((delta) => _MakeItem("Axe1"))
                       .Action((delta) => _Talk("Produced axe."))
                       .End()
                       .Sequence()
                       .Action((delta) => _If(index == 1))
                       .Action((delta) => _CheckItemAmount("Sword1", (count) => count < 2))
                       .Action((delta) => _MakeItem("Sword1"))
                       .Action((delta) => _Talk("Produced sword."))
                       .End()

                       .Sequence()
                       .Action((delta) => _If(index == 2))
                       .Action((delta) => _CheckItemAmount("Lamp", (count) => count < 2))
                       .Action((delta) => _MakeItem("Lamp"))
                       .Action((delta) => _Talk("Produced lamp."))
                       .End()

                       .Sequence()
                       .Action((delta) => _If(index == 3))
                       .Action((delta) => _CheckItemAmount("AidKit", (count) => count < 2))
                       .Action((delta) => _MakeItem("AidKit"))
                       .Action((delta) => _Talk("Produced aid."))
                       .End()
                       .Sequence()
                       .Action((delta) => _Talk("Nothing maked."))
                       .End()

                       .End()
                       .Action(_ReleaseMake)
                       .End()
                       .Build();

            return(node);
        }
Beispiel #2
0
        private ITicker _EquipItemStrategy()
        {
            var timeTrigger = new TimeTriggerStrategy(1f);
            var builder     = new Regulus.BehaviourTree.Builder();
            var node        = builder
                              .Sequence()
                              .Action(timeTrigger.Tick)
                              .Action((delta) => timeTrigger.Reset(1))
                              .Selector()
                              .Action((delta) => _Equip(EQUIP_PART.RIGHT_HAND))
                              .Action((delta) => _Equip(EQUIP_PART.FIXTURES))
                              .End()

                              .End()
                              .Build();

            return(node);
        }
Beispiel #3
0
        private ITicker _DiscardItemStrategy()
        {
            var builder = new Regulus.BehaviourTree.Builder();

            var timeTrigger = new TimeTriggerStrategy(10f);

            var node = builder
                       .Sequence()
                       .Action(timeTrigger.Tick)
                       .Action((delta) => timeTrigger.Reset(10f))
                       .Selector()
                       .Sequence()
                       .Action((delta) => _CheckItemAmount("Axe1", (count) => count >= 2))
                       .Action((delta) => _DiscardItem("Axe1", 1))
                       .Action((delta) => _Talk("Discard axe."))
                       .End()
                       .Sequence()
                       .Action((delta) => _CheckItemAmount("Sword1", (count) => count >= 2))
                       .Action((delta) => _DiscardItem("Sword1", 1))
                       .Action((delta) => _Talk("Discard sword."))
                       .End()

                       .Sequence()
                       .Action((delta) => _CheckItemAmount("Lamp", (count) => count >= 2))
                       .Action((delta) => _DiscardItem("Lamp", 1))
                       .Action((delta) => _Talk("Discard lamp."))
                       .End()

                       .Sequence()
                       .Action((delta) => _CheckItemAmount("AidKit", (count) => count >= 2))
                       .Action((delta) => _DiscardItem("AidKit", 1))
                       .Action((delta) => _Talk("Discard AidKit."))
                       .End()
                       .End()

                       .End()
                       .Build();

            return(node);
        }