Пример #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();
        }
 public VendorList(VendorDefinition definition)
 {
     m_Definition = definition;
     m_Vendors    = new FactionVendorCollection();
 }
 /// <summary>
 /// Default constructor for enumerator.
 /// </summary>
 /// <param name="collection">Instance of the collection to enumerate.</param>
 internal FactionVendorCollectionEnumerator(FactionVendorCollection collection)
 {
     _index = -1;
     _collection = collection;
 }
Пример #4
0
		public VendorList( VendorDefinition definition )
		{
			m_Definition = definition;
			m_Vendors = new FactionVendorCollection();
		}
 /// <summary>
 /// Default constructor for enumerator.
 /// </summary>
 /// <param name="collection">Instance of the collection to enumerate.</param>
 internal FactionVendorCollectionEnumerator(FactionVendorCollection collection)
 {
     _index      = -1;
     _collection = collection;
 }