Example #1
0
        /// <summary>
        /// Removes every Thing from the pigWorld, but will leave the Walls in place.
        /// </summary>
        public void RemoveAllThings()
        {
            // Because the Delete method updates the list of Things, we make a copy of the list first.
            List <Thing> localListOfThings = new List <Thing>(Things);

            for (int i = 0; i < localListOfThings.Count; i++)
            {
                // The Things update themselves, so we can't use "foreach" here.
                Thing thing = localListOfThings[i];
                if (!thing.Exists())
                {
                    continue;
                }
                thing.Delete();
            }

            LifeForm.ResetAllIds();
        }