Пример #1
0
        //called to deactivate this border:
        public void Disable()
        {
            if (IsActive == false)                   //if the border isn't even active:
            {
                return;                              //do not proceed.
            }
            foreach (Resource r in resourcesInRange) //free the resources inside this border
            {
                r.FactionID = -1;
            }

            resourcesInRange.Clear();

            //Go through all the borders' centers to refresh the resources inside this border (as one of the freed resources above could now belong to another center):
            foreach (Border b in gameMgr.BuildingMgr.GetAllBorders())
            {
                b.CheckAllResources();              //borders that were placed first will have priority over borders that were placed later
            }
            CustomEvents.OnBorderDeactivated(this); //trigger custom event

            //Destroy the border object if it has been created
            if (spawnObj == true)
            {
                Destroy(obj);
            }
        }
Пример #2
0
        /// <summary>
        /// Deactivates the border.
        /// </summary>
        public void Disable()
        {
            if (IsActive == false) //if the border isn't even active:
            {
                return;            //do not proceed.
            }
            RemoveAllResources();  //free all resources in this border's territory

            //unsubscribe from following events:
            OnDestroy();

            CustomEvents.OnBorderDeactivated(this); //trigger custom event

            //Destroy the border object if it has been created
            if (spawnObj == true)
            {
                Destroy(obj);
            }
        }