示例#1
0
        /// <summary>
        /// Removes the specified behavior.
        /// </summary>
        /// <param name="behavior">The behavior.</param>
        public void RemoveBehavior(SteeringBehavior behavior)
        {
            List <SteeringBehavior> list;

            if (SteeringBehaviors.TryGetValue(behavior.Priority, out list))
            {
                list.Remove(behavior);
            }
        }
示例#2
0
        /// <summary>
        /// Adds the specified behavior.
        /// </summary>
        /// <param name="behavior">The behavior.</param>
        public void AddBehavior(SteeringBehavior behavior)
        {
            List <SteeringBehavior> list;

            SteeringBehaviors.TryGetValue(behavior.Priority, out list);

            if (list != null)
            {
                list.Add(behavior);
            }
            else
            {
                SteeringBehaviors.Add(behavior.Priority, new List <SteeringBehavior>()
                {
                    behavior
                });
            }
        }