示例#1
0
    public override bool UpdateBehavior(Mob mob)
    {
        if (behaviors.Count > 0)
        {
            BaseBehavior curBehavior = behaviors.First.Value;

            if (curBehavior.State == BehaviorState.NotStarted)
            {
                curBehavior.StartBehavior(mob);
            }

            if (!curBehavior.UpdateBehavior(mob))
            {
                curBehavior.EndBehavior(mob);
                behaviors.RemoveFirst();
            }

            return(true);
        }

        return(false);
    }