Beispiel #1
0
 private Spell CheckForDuplicates(string reqSpellName)
 {
     System.Collections.Generic.IEnumerable <Spell> spellQuery = effectList.Where(spell => spell.spellName == reqSpellName);
     if (spellQuery.Count() > 0)
     {
         return(spellQuery.First());
     }
     return(null);
 }
 private IEnumerator CycleState()
 {
     while (true)
     {
         System.Collections.Generic.IEnumerable <CatBehaviorState> values = Enum.GetValues(typeof(CatBehaviorState))
                                                                            .Cast <CatBehaviorState>()
                                                                            .Where(s =>
                                                                                   s != CatBehaviorState.WalkAway &&
                                                                                   s != CatBehaviorState.RunAway &&
                                                                                   s != CatBehaviorState.MovingToFood &&
                                                                                   s != CatBehaviorState.Eating);
         CatBehaviorState newState = (CatBehaviorState)values.ElementAt(Random.Range(0, values.Count()));
         if (newState == CatBehaviorState.Moving)
         {
             this.destination = new Vector2(Random.Range(-20f, 20f), Random.Range(-20f, 20f));
         }
         this.state = newState;
         yield return(new WaitForSeconds(Random.Range(1f, 5f)));
     }
 }
Beispiel #3
0
 /// <summary>
 /// Create a new instance of the Deque class with the elements
 /// from the specified collection.
 /// </summary>
 /// <param name="collection">The co</param>
 public Deque(IEnumerable <T> collection) : this(collection.Count())
 {
     InsertRange(0, collection);
 }
Beispiel #4
0
        /// <summary>
        /// Inserts a collection of items into the Deque
        /// at the specified index.
        /// </summary>
        /// <param name="index">
        /// The index in the Deque to insert the collection.
        /// </param>
        /// <param name="collection">The collection to add.</param>
        public void InsertRange(int index, IEnumerable <T> collection)
        {
            var count = collection.Count();

            this.InsertRange(index, collection, 0, count);
        }
Beispiel #5
0
 /// <summary>
 /// Adds a collection of items to the back of the Deque.
 /// </summary>
 /// <param name="collection">The collection to add.</param>
 public void AddBackRange(IEnumerable <T> collection)
 {
     AddBackRange(collection, 0, collection.Count());
 }