示例#1
0
        public void Capture(Faction f)
        {
            f.Silver += SilverCaptureBonus;

            if (m_State.Owner == f)
            {
                return;
            }

            if (m_State.Owner == null)               // going from unowned to owned
            {
                LastIncome = DateTime.Now;
            }
            else if (f == null)               // going from owned to unowned
            {
                LastIncome = DateTime.MinValue;
            }
            // otherwise changing hands, income timer doesn't change

            m_State.Owner = f;

            Sheriff = null;
            Finance = null;

            TownMonolith monolith = this.Monolith;

            if (monolith != null)
            {
                monolith.Faction = f;
            }

            VendorListCollection vendorLists = VendorLists;

            for (int i = 0; i < vendorLists.Count; ++i)
            {
                VendorList vendorList           = vendorLists[i];
                FactionVendorCollection vendors = vendorList.Vendors;

                for (int j = vendors.Count - 1; j >= 0; --j)
                {
                    vendors[j].Delete();
                }
            }

            GuardListCollection guardLists = GuardLists;

            for (int i = 0; i < guardLists.Count; ++i)
            {
                GuardList guardList           = guardLists[i];
                FactionGuardCollection guards = guardList.Guards;

                for (int j = guards.Count - 1; j >= 0; --j)
                {
                    guards[j].Delete();
                }
            }

            ConstructGuardLists();
        }
 /// <summary>
 /// Default constructor for enumerator.
 /// </summary>
 /// <param name="collection">Instance of the collection to enumerate.</param>
 internal FactionGuardCollectionEnumerator(FactionGuardCollection collection)
 {
     _index = -1;
     _collection = collection;
 }
 /// <summary>
 /// Default constructor for enumerator.
 /// </summary>
 /// <param name="collection">Instance of the collection to enumerate.</param>
 internal FactionGuardCollectionEnumerator(FactionGuardCollection collection)
 {
     _index      = -1;
     _collection = collection;
 }
示例#4
0
 public GuardList(GuardDefinition definition)
 {
     m_Definition = definition;
     m_Guards     = new FactionGuardCollection();
 }
示例#5
0
 public GuardList( GuardDefinition definition )
 {
     m_Definition = definition;
     m_Guards = new FactionGuardCollection();
 }