示例#1
0
 public void AddWaitBehavior(UNBehaviorType bType,
                             int priority = 0,
                             UNBehaviorStateType bState = UNBehaviorStateType.Wait,
                             UNBehaviorChangeStateCallBack cbBeforeChange = null,
                             UNBehaviorChangeStateCallBack cbAfterChange  = null)
 {
     m_cbsBeforeBehaviorChange.Add(cbBeforeChange);
     m_cbsAfterBehaviorChange.Add(cbAfterChange);
     AddWaitBehavior(UNBehavior.New(bType, priority, bState, m_cbsBeforeBehaviorChange, m_cbsAfterBehaviorChange));
 }
示例#2
0
 public void AddBehaviorImmediate(UNBehaviorType bType,
                                  int priority = 0,
                                  UNBehaviorStateType bState = UNBehaviorStateType.Wait,
                                  UNBehaviorChangeStateCallBack cbBeforeChange = null,
                                  UNBehaviorChangeStateCallBack cbAfterChange  = null)
 {
     m_cbsBeforeBehaviorChange.Add(cbBeforeChange);
     m_cbsAfterBehaviorChange.Add(cbAfterChange);
     if (m_curBehavior.IsNull())
     {
         m_curBehavior = UNBehavior.New();
         m_curBehavior.ResetToBehavior(bType, priority, bState, m_cbsBeforeBehaviorChange, m_cbsAfterBehaviorChange);
     }
     else
     {
         m_curBehavior.ChangeToState(UNBehaviorStateType.Finish);
         m_curBehavior.ResetToBehavior(bType, priority, bState, m_cbsBeforeBehaviorChange, m_cbsAfterBehaviorChange);
     }
     m_curBehavior.ChangeToState(UNBehaviorStateType.Execute);
 }