Пример #1
0
 private void NotifyAboutResources()
 {
     Text[] texts = { rPanel.herbs, rPanel.chems, rPanel.plastic, rPanel.researchPoints };
     foreach (Text t in texts)
     {
         StartCoroutine(interpol.InOut(t, Color.red));
     }
 }
Пример #2
0
    public bool CheckForChanges(Text text, int value, Color addColor)
    {
        int oldValue = ParseResource(text.text);

        if (oldValue - value < 0)
        {
            StartCoroutine(interpol.InOut(text, addColor));
            StartCoroutine(GetComponent <Scaler>().Scale(text));
            text.transform.parent.GetComponentInChildren <ParticleSystem>().Play();
            return(true);
        }
        else if (oldValue - value > 0)
        {
            StartCoroutine(interpol.InOut(text, Color.red));
            StartCoroutine(GetComponent <Scaler>().Scale(text));
            return(true);
        }
        return(false);
    }
Пример #3
0
    public void Upgrade(int level, bool chargePlayer = true)
    {
        if (chargePlayer)
        {
            if (resourceStorage.money < upgradeCost)
            {
                lvl--;
                StartCoroutine(interpol.InOut(uPanel.cost, Color.red));
                return;
            }
            resourceStorage.ChangeBalance(-upgradeCost);
            GameController.instance.player.GainExperience(GameController.instance.roomOverseer.GetAllSceneObjects().Where(x => x.GetType() == this.GetType()).ToList().Count *50);
            if (onUpgrade != null)
            {
                onUpgrade.gameObject.SetActive(true);
                onUpgrade.Play();
            }
            StartCoroutine(GameController.instance.cam.FocusCamera(this.transform.position));
            EventManager.TriggerEvent("OnUpgrade");
            GameController.instance.audio.MakeSound(onUpgradeSound[Random.Range(0, onUpgradeSound.Count)]);
        }
        MergeAdjacentRooms(this);
        IncreaseStats(level, chargePlayer);
        upgradeCost = (int)((description.buyPrice / 2) + (level) * (description.buyPrice / 5));
        GetComponent <SpriteRenderer>().sprite = description.upgradedSprite;
        if (uPanel != null)
        {
            uPanel.Hide();
        }
        if (lvl == 2 && hasJointedObject)
        {
            ChangeViewToDouble();
            if (GetComponent <ResearchCenter>())
            {
                currentStorage += upgradedStorage * 2;
            }
            else
            {
                currentStorage += upgradedStorage * 5;
            }

            IncreaseStats(++level, chargePlayer);
            lvl++;
        }
    }
Пример #4
0
    public void Construct(int id)
    {
        if (selectedCell.transform.childCount >= 1)
        {
            return;
        }
        if (GameController.instance.player.resources.money < objectsToConstruct[id].description.buyPrice)
        {
            StartCoroutine(interpol.InOut(confirm.confirmText, Color.red));
            return;
        }
        Build(id);
        GameController.instance.player.resources.ChangeBalance(-objectsToConstruct[id].description.buyPrice);
        if (!GameController.instance.generalTutorial.isTutorialCompleted)
        {
            GameController.instance.generalTutorial.isBlocked = false; GameController.instance.generalTutorial.ContinueTutorial(); GameController.instance.generalTutorial.ContinueTutorial();
        }
        Abort();

        ConstructOFF();
    }