예제 #1
0
 public void SendWorkers(int x, WorkBuilding w)
 {
     if (freeWorkers == 0 | w == null)
     {
         return;
     }
     if (x > freeWorkers)
     {
         x = freeWorkers;
     }
     else
     {
         freeWorkers = freeWorkers - x + w.AddWorkers(x);
     }
 }
예제 #2
0
    override public void LevelUp(bool returnToUI)
    {
        if (upgradedIndex == -1)
        {
            return;
        }
        if (!GameMaster.realMaster.weNeedNoResources)
        {
            ResourceContainer[] cost = GetUpgradeCost();
            if (!colony.storage.CheckBuildPossibilityAndCollectIfPossible(cost))
            {
                GameLogUI.NotEnoughResourcesAnnounce();
                return;
            }
        }
        WorkBuilding upgraded = GetStructureByID(upgradedIndex) as WorkBuilding;

        upgraded.Prepare();
        PixelPosByte setPos = new PixelPosByte(surfaceRect.x, surfaceRect.z);

        if (upgraded.surfaceRect.size == 16)
        {
            setPos = new PixelPosByte(0, 0);
        }
        int workers = workersCount;

        workersCount = 0;
        if (upgraded.rotate90only & (modelRotation % 2 != 0))
        {
            upgraded.modelRotation = (byte)(modelRotation - 1);
        }
        else
        {
            upgraded.modelRotation = modelRotation;
        }
        upgraded.AddWorkers(workers);
        upgraded.SetBasement(basement, setPos);
        GameMaster.realMaster.eventTracker?.BuildingUpgraded(this);
        if (returnToUI)
        {
            upgraded.ShowOnGUI();
        }
        //copied to factory.levelup
    }
예제 #3
0
    override public void LevelUp(bool returnToUI)
    {
        if (upgradedIndex == -1)
        {
            return;
        }
        if (!GameMaster.realMaster.weNeedNoResources)
        {
            ResourceContainer[] cost = GetUpgradeCost();
            if (!GameMaster.colonyController.storage.CheckBuildPossibilityAndCollectIfPossible(cost))
            {
                UIController.current.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.NotEnoughResources));
                return;
            }
        }
        WorkBuilding upgraded = GetStructureByID(upgradedIndex) as WorkBuilding;

        upgraded.Prepare();
        PixelPosByte setPos = new PixelPosByte(innerPosition.x, innerPosition.z);

        if (upgraded.innerPosition.size == 16)
        {
            setPos = new PixelPosByte(0, 0);
        }
        int workers = workersCount;

        workersCount = 0;
        if (upgraded.rotate90only & (modelRotation % 2 != 0))
        {
            upgraded.modelRotation = (byte)(modelRotation - 1);
        }
        else
        {
            upgraded.modelRotation = modelRotation;
        }
        upgraded.AddWorkers(workers);
        upgraded.SetBasement(basement, setPos);
        if (returnToUI)
        {
            upgraded.ShowOnGUI();
        }
    }