示例#1
0
 /// <summary>
 /// Add a new <see cref="StateBehaviour"/> to this State
 /// </summary>
 /// <param name="behaviour">The <see cref="StateBehaviour"/> to add</param>
 public void AddBehaviour(StateBehaviour behaviour)
 {
     if (!Array.Exists(m_Behaviours, element => element == behaviour))
     {
         Array.Resize(ref m_Behaviours, m_Behaviours.Length + 1);
         m_Behaviours[m_Behaviours.Length - 1] = behaviour;
     }
 }
示例#2
0
 /// <summary>
 /// Add a <see cref="StateBehaviour"/> from this State
 /// </summary>
 /// <param name="behaviour">The <see cref="StateBehaviour"/> to remove</param>
 public void RemoveBehaviour(StateBehaviour behaviour)
 {
     if (Array.Exists(m_Behaviours, element => element == behaviour))
     {
         var index = Array.IndexOf(m_Behaviours, behaviour);
         for (int i = index; i < m_Behaviours.Length - 1; i++)
         {
             m_Behaviours[i] = m_Behaviours[i + 1];
         }
         Array.Resize(ref m_Behaviours, m_Behaviours.Length - 1);
     }
 }