コード例 #1
0
    void setup_melee_ki()
    {
        root = new UtilFail();
        {
            var parallel = new ParralelNode();
            {
                var unitlfail4 = new UtilFail(true);
                {
                    var sequence01 = new Sequence();
                    {
                        var player_find = new find_player_task();
                        var unitlfail   = new UtilFail(true);
                        {
                            var sequence03 = new Sequence();
                            {
                                var selector01 = new Selector();
                                {
                                    var player_moved  = new target_moved_condition();
                                    var see_player    = new has_target_in_eyesigth_contiditon("Player");
                                    var next_waypoint = new  go_to_next_waypoint_task();
                                    selector01.AddChild(player_moved);
                                    selector01.AddChild(see_player);
                                    selector01.AddChild(next_waypoint);
                                }
                                var not_node = new Not();
                                {
                                    var see_player2 = new has_target_in_eyesigth_contiditon("Player");
                                    not_node.AddChild(see_player2);
                                }

                                sequence03.AddChild(selector01);
                                sequence03.AddChild(not_node);
                            }
                            unitlfail.AddChild(sequence03);
                        }
                        var unitlfail2 = new UtilFail(true);
                        {
                            var sequence02 = new Sequence();
                            {
                                var see_player = new has_target_in_eyesigth_contiditon("Player");
                                var charge     = new  charge_target_task("Player");
                                sequence02.AddChild(see_player);
                                sequence02.AddChild(charge);
                            }
                            unitlfail2.AddChild(sequence02);
                        }
                        sequence01.AddChild(unitlfail2);
                        sequence01.AddChild(player_find);
                        sequence01.AddChild(unitlfail);
                    }
                    unitlfail4.AddChild(sequence01);
                }
                var unitlfail3 = new UtilFail(true);
                {
                    var attack = new shoot_on_target_task("Player");
                    unitlfail3.AddChild(attack);
                }
                parallel.AddChild(unitlfail4);
                parallel.AddChild(unitlfail3);
            }
            root.AddChild(parallel);
        }
    }
コード例 #2
0
    void setup_normal_ki()
    {
        root = new UtilFail();
        {
            var selector00 = new Selector();
            {
                var parallel3 = new ParralelNode();
                {
                    var enough_health = new has_health_condition(health_max * 0.3f);
                    var selector      = new Selector();
                    {
                        var until_fail = new UtilFail(false);
                        {
                            var sequence = new Sequence();
                            {
                                var isnearnode   = new is_in_range(follow_range, "Player");
                                var iscoverdnode = new is_cover_blown_condition("Player");
                                var until_fail2  = new UtilFail(true);
                                var cover        = new cover_task();
                                var enough_ammo  = new has_ammo_condition(1);

                                sequence.AddChild(isnearnode);
                                sequence.AddChild(iscoverdnode);
                                sequence.AddChild(until_fail2);
                                sequence.AddChild(cover);
                                sequence.AddChild(enough_ammo);
                                {
                                    var sequence2 = new Sequence();
                                    {
                                        var dangernode = new shoot_on_me_condition();
                                        isnearnode = new is_in_range(follow_range, "Player");
                                        var shoottargetnode = new shoot_on_target_task("Player");
                                        enough_ammo = new has_ammo_condition(1);

                                        sequence2.AddChild(dangernode);
                                        sequence2.AddChild(isnearnode);
                                        sequence2.AddChild(shoottargetnode);
                                        sequence2.AddChild(enough_ammo);
                                    }
                                    until_fail2.AddChild(sequence2);
                                }
                            }
                            until_fail.AddChild(sequence);
                        }
                        selector.AddChild(until_fail);
                    }
                    {
                        var sequence1 = new Sequence();
                        {
                            var selector2 = new Selector();
                            {
                                var enough_ammo3 = new has_ammo_condition(1);
                                var sequence2    = new Sequence();
                                {
                                    var find_ammo   = new find_ammo_task();
                                    var until_fail2 = new UtilFail(true);
                                    {
                                        var next_waypoint = new go_to_next_waypoint_task();
                                        until_fail2.AddChild(next_waypoint);
                                    }
                                    sequence2.AddChild(find_ammo);
                                    sequence2.AddChild(until_fail2);
                                }
                                selector2.AddChild(enough_ammo3);
                                selector2.AddChild(sequence2);
                            }
                            var sequence3 = new Sequence();
                            {
                                var sgtask      = new search_and_go_to_cover_task(0.6f);
                                var until_fail3 = new UtilFail(true);
                                {
                                    var parralel = new ParralelNode();
                                    {
                                        var sequence4 = new Sequence();
                                        {
                                            var is_way_good   = new way_still_good_condition(0.6f);
                                            var next_waypoint = new go_to_next_waypoint_task();
                                            sequence4.AddChild(is_way_good);
                                            sequence4.AddChild(next_waypoint);
                                        }
                                        var selector3 = new Selector();
                                        {
                                            var sequence5 = new Sequence();
                                            {
                                                var isnearnode      = new is_in_range(follow_range, "Player");
                                                var shoottargetnode = new shoot_on_target_task("Player");
                                                sequence5.AddChild(isnearnode);
                                                sequence5.AddChild(shoottargetnode);
                                            }
                                            var enough_ammo4 = new has_ammo_condition(1);
                                            selector3.AddChild(sequence5);
                                            selector3.AddChild(enough_ammo4);
                                        }
                                        parralel.AddChild(sequence4);
                                        parralel.AddChild(selector3);
                                    }
                                    until_fail3.AddChild(parralel);
                                }
                                sequence3.AddChild(sgtask);
                                sequence3.AddChild(until_fail3);
                            }
                            sequence1.AddChild(selector2);
                            sequence1.AddChild(sequence3);
                        }
                        selector.AddChild(sequence1);
                    }
                    parallel3.AddChild(enough_health);
                    parallel3.AddChild(selector);
                }
                var sequence6 = new Sequence();
                {
                    var find_health = new find_heathpack_task();
                    var until_fail2 = new UtilFail(true);
                    {
                        var next_waypoint = new go_to_next_waypoint_task();
                        until_fail2.AddChild(next_waypoint);
                    }
                    sequence6.AddChild(find_health);
                    sequence6.AddChild(until_fail2);
                }
                selector00.AddChild(parallel3);
                selector00.AddChild(sequence6);
            }
            root.AddChild(selector00);
        }
    }