当前位置: 首页>>代码示例>>C#>>正文


C# Sequence.AddChild方法代码示例

本文整理汇总了C#中Sequence.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Sequence.AddChild方法的具体用法?C# Sequence.AddChild怎么用?C# Sequence.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sequence的用法示例。


在下文中一共展示了Sequence.AddChild方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        tree = new BehaviourTree();
        teste = new TestBehaviourInstant(this);
        teste2 = new TestBehaviour5Times(this);
        sequence = new Sequence(tree);
        sequence.AddChild(teste);
        sequence.AddChild(teste2);

        tree.Insert(sequence, null);

        manager = new ActionManager();
    }
开发者ID:Suike,项目名称:Tools,代码行数:13,代码来源:TesteHeap.cs

示例2: GenerateAttackBehavior

        public Composite GenerateAttackBehavior()
        {
            Sequence AttackSequence = new Sequence();

            AttackSequence.AddChild(new Action((ActionSucceedDelegate)DetermineBestAttackAndTarget));
            AttackSequence.AddChild(new Action((ActionSucceedDelegate)ExecuteAttack));
            AttackSequence.AddChild(new Sleep(100));

            return AttackSequence;
        }
开发者ID:ipo,项目名称:AGBA,代码行数:10,代码来源:GenericCombat.cs

示例3: GenerateTownPortalBehavior

        public Composite GenerateTownPortalBehavior()
        {
            CanRunDecoratorDelegate InTown = delegate
                                                 {
                                                     bool timeOut = (_lastTP + TPTimer < Environment.TickCount);
                if (ZetaDia.Me == null) return false;
                if (!ZetaWrap.IsInTown() && (ZetaDia.Me.CommonData.AnimationState != AnimationState.Channeling || timeOut))
                {
                    _lastTP = Environment.TickCount;
                    return true;
                }
                return false;
            };

            var pSequence = new Sequence();
            var PortHome = new Action(delegate
            {
                ZetaDia.Me.UseTownPortal();
                return RunStatus.Success;
            });
            pSequence.AddChild(PortHome);
            return new DecoratorContinue(InTown, PortHome);
        }
开发者ID:ipo,项目名称:AGBA,代码行数:23,代码来源:Vendoring.cs

示例4: CreateClearPendingCursorSpell

        /// <summary>
        /// targeting is blocked if pending spell on cursor, so this routine checks if a spell is on cursor
        /// awaiting target and if so clears
        /// </summary>
        /// <param name="finalResult">what result should be regardless of clearing spell</param>
        /// <returns>always finalResult</returns>
        private static Composite CreateClearPendingCursorSpell(RunStatus finalResult)
        {
            Sequence seq = new Sequence(
                new Action(r => Logger.WriteDebug(targetColor, "EnsureTarget: /cancel Pending Spell {0}", Spell.GetPendingCursorSpell.Name)),
                new Action(ctx => Lua.DoString("SpellStopTargeting()"))
                );

            if (finalResult == RunStatus.Success )
                return new DecoratorContinue(ret => Spell.GetPendingCursorSpell != null, seq);

            seq.AddChild( new ActionAlwaysFail() );
            return new Decorator(ret => Spell.GetPendingCursorSpell != null, seq);
        }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:19,代码来源:Safers.cs

示例5: Restart

    public void Restart()
    {
        // Creating and setting some basic values for the blackboard
        m_Blackboard = new Blackboard();
        m_Blackboard.Trans = transform;
        m_Blackboard.StartPoint = transform.position;
        GameObject player = GameObject.FindGameObjectWithTag("Player");
        if (player) {
            m_Blackboard.Player = player.transform;
        }
        m_Blackboard.Destination = transform.position + new Vector3(10, 0, 5);
        m_Blackboard.LookAtObject = GetComponent<Looker>();

        //-------------------------------------------------------------------------
        // Higher level sequence/selectors which we'll add leaf behaviors to later
        //-------------------------------------------------------------------------
        Sequence randomMove = new Sequence();
        Sequence moveToBeacon = new Sequence();

        //----------------------------------------------------------------------------------
        // Create leaf behaviors. Should only need one of each.
        // Some of these get used often (MoveToPoint), others are specific (CheckForBeacon)
        //----------------------------------------------------------------------------------
        MoveToPoint moveToPoint = new MoveToPoint();
        PickRandomTarget pickRandomTarget = new PickRandomTarget();
        CheckForBeacon checkForBeacon = new CheckForBeacon();
        ChasePlayer chasePlayer = new ChasePlayer();
        Stunned stunned = new Stunned();

        //---------------------------------------------------------------------------------------
        // Building the subtrees.
        // Add children to subtrees in left to right order, since each AddChild is doing a push_back
        //----------------------------------------------------------------------------------------
        moveToBeacon.AddChild(checkForBeacon);
        moveToBeacon.AddChild(moveToPoint);

        randomMove.AddChild(pickRandomTarget);
        randomMove.AddChild(moveToPoint);

        //--------------------------------------------------
        // Add subtrees to the root.
        // Like before, add behaviors in left to right order
        //--------------------------------------------------
        m_Root.AddChild(stunned);
        m_Root.AddChild(moveToBeacon);
        m_Root.AddChild(chasePlayer);
        m_Root.AddChild(randomMove);

        //m_Blackboard.MovementPath = NavGraphConstructor.Instance.FindPathToLocation(m_Blackboard.Trans.position, m_Blackboard.Destination);
        //m_Blackboard.PathCurrentIdx = 0;

        //		repeat.m_Child = randomMove;
        //
        //		// Try out Chase behavior
        //		m_Chase = new Chase(moveBehavior, m_Bt);
        //		m_Flee = new Flee(moveBehavior, m_Bt);
        //
        //		List<Behavior> tree = new List<Behavior>();
        //		tree.Add(repeat);
        //		tree.Add(m_Chase);
        //
        //		root.m_Children = tree;
        //
        //		m_Bt.Start(root, this.SequenceComplete);
    }
开发者ID:natural20s,项目名称:ProjectAccountingSoftware,代码行数:65,代码来源:Entity.cs


注:本文中的Sequence.AddChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。