Esempio n. 1
0
    private void DemolishAction()
    {
        //print("Selected name:" + b.name);
        if (BuildingPot.Control.Registro.SelectBuilding.Category == Ca.Way)
        {
            Trail b = BuildingPot.Control.Registro.SelectBuilding as Trail;
            b.Demolish();
        }
        else if (BuildingPot.Control.Registro.SelectBuilding.Category == Ca.Structure ||
                 BuildingPot.Control.Registro.SelectBuilding.Category == Ca.Shore)
        {
            Structure b = BuildingPot.Control.Registro.SelectBuilding as Structure;

            if (BuildingPot.Control.IsThisTheLastFoodSrc(b))
            {
                Program.gameScene.GameController1.NotificationsManager1.MainNotify("LastFood");
                return;
            }
            if (BuildingPot.Control.IsThisTheLastOfThisType(H.Masonry, b))
            {
                Program.gameScene.GameController1.NotificationsManager1.MainNotify("LastMasonry");
                return;
            }
            if (BuildingPot.Control.Registro.AreUDemolishingOneAlready())
            {
                Program.gameScene.GameController1.NotificationsManager1.MainNotify("OnlyOneDemolish");
                return;
            }

            var wasDemolished = b.Demolish();
            if (wasDemolished)
            {
                OnDemolish(EventArgs.Empty);
            }
        }
        else if (BuildingPot.Control.Registro.SelectBuilding.Category == Ca.DraggableSquare)
        {
            DragSquare b = BuildingPot.Control.Registro.SelectBuilding as DragSquare;
            b.Demolish();
        }

        //Program.InputMain.InputMouse.UnSelectCurrent();
        //DestroyForm();
    }