Example #1
0
    private IEnumerator UnloadCapacity()
    {
        yield return(new WaitForSeconds(timeToUnload));

        var spaceLeftInGroundFloorContainer = groundFloorContainer.GetMaxCapacity() - groundFloorContainer.CurrentCapacity;

        if (currentLoad <= spaceLeftInGroundFloorContainer)
        {
            int groundFloorCap = groundFloorContainer.CurrentCapacity;
            groundFloorContainer.SetNewContainerCapacity(groundFloorCap + currentLoad);
            currentLoad = 0;
            groundFloorContainer.SetContainerCapacityText();
            SetElevatorWOrkerCapacityText();
            isFullyLoaded = false;
        }

        if (currentLoad > spaceLeftInGroundFloorContainer)
        {
            currentLoad -= spaceLeftInGroundFloorContainer;
            groundFloorContainer.SetNewContainerCapacity(groundFloorContainer.GetMaxCapacity());
            groundFloorContainer.SetContainerCapacityText();
            SetElevatorWOrkerCapacityText();
            isFullyLoaded = false;
        }

        if (spaceLeftInGroundFloorContainer == 0)
        {
            Debug.LogWarning("Elevator Worker cant unload");
        }

        if (!hasManager)
        {
            active = false;
        }

        spriteR.sprite  = workerIcon;
        index           = 1;
        loadingPosition = loadingPositions[index];
        StopAllCoroutines();
    }
Example #2
0
    private void HandleOverdaysUpgraded()
    {
        workers = GetAllWorkers();
        var allMinersMaxed = false;

        foreach (var miner in workers)
        {
            if (miner.timesUpdated == 3)
            {
                allMinersMaxed = true;
                continue;
            }

            if (miner.timesUpdated > 3)
            {
                continue;
            }

            miner.SetWalkingSpeed(miner.GetWalkingSpeed() * multiplier);
            miner.SetCap(Mathf.RoundToInt(miner.GetCapacity() * multiplier));
            miner.SetTimeToLoad(miner.GetTimeToLoad() - multiplier / 2);
            miner.SetTimeToUnload(miner.GetTimeToUnload() - multiplier / 2);
            miner.AddUpdateAmount();
            allMinersMaxed = false;
        }

        if (allMinersMaxed)
        {
            AddNewMiner();
        }

        overdaysContainer.SetNewMaxCapacity(Mathf.RoundToInt(overdaysContainer.GetMaxCapacity() * 1.7f));
        overdaysContainer.SetContainerCapacityText();

        var newUpgradeCost = GameCore.Instance.Data.GetNewUpgradeCost(upgradeButton.upgradeCost);

        upgradeButton.SetNewUpgradeCost(newUpgradeCost);
    }