Esempio n. 1
0
    public void PreviewUpgrade(Upgrade upgrade)
    {
        int?previewTime = simManager.GetTimeToPurchase(upgrade);

        if (numPreviews > 0 && lastPreviewTime != previewTime)
        {
            throw new Exception($"Trying to preview time {previewTime} while already showing a preview of time {lastPreviewTime}");
        }

        numPreviews++;
        lastPreviewTime = previewTime;

        RepaintTimeline();
        if (lastPreviewTime != null)
        {
            int currentTime = CurrentSim.CurrentTime;
            for (int timeStep = currentTime + 1; timeStep < currentTime + lastPreviewTime; timeStep++)
            {
                Elements[timeStep].PaintPreview();
            }

            Elements[currentTime + lastPreviewTime.Value].PaintUpgradePreview();
        }
        else
        {
            int currentTime = CurrentSim.CurrentTime;
            for (int timeStep = currentTime + 1; timeStep < Elements.Count; timeStep++)
            {
                Elements[timeStep].PaintInvalidPreview();
            }
        }

        // TODO show a different color/size if null
    }
Esempio n. 2
0
    private void UpdateDisplay()
    {
        Quantity.text = $"{Simulation.ActualSims.CurrentSim.boughtUpgrades.Count(upgrade => upgrade == Upgrade)} owned";

        int?timeToGet = Simulation.GetTimeToPurchase(Upgrade);

        BuyButton.interactable = timeToGet != null && !Simulation.IsLocked;
        BuyButton.GetComponent <UpgradeBuyButton>().UpdateButton(timeToGet);
    }
Esempio n. 3
0
 private void MaybeShowModal()
 {
     if (fastForwarding == true)
     {
         return;
     }
     if (Sim.AllUpgrades.All(upgrade => Sim.GetTimeToPurchase(upgrade) == null))
     {
         StartCoroutine(ShowModal());
     }
 }