本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}