public void SetPanel(Characteristics characteristics)
    {
        icons.gameObject.SetActive(false);
        crafter.view.DisableAllParticles();
        blackBack.enabled = true;
        gameObject.SetActive(true);
        slider.value = 0;
        quantity     = 1;
        popAnim.Play("Pop_out_CreationPanel");

        input.text           = string.Empty;
        this.characteristics = characteristics;
        rPanel.SetPanel(characteristics);
        rPanel.researchPoints.text = crafter.CalculateResearchPoints(crafter.selectedTalents).ToString();
        Recipe testRecipe = crafter.RecognizeRecipe();


        if (testRecipe != null)
        {
            crafter.recipeSelected = testRecipe;
            crafter.isPrescripted  = true;
            characteristics        = crafter.Recombine(characteristics);
            characteristics        = crafter.GetCharacteristics();
        }
        if (crafter.isPrescripted)
        {
            ok.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
            rPanel.researchPoints.gameObject.SetActive(false);
            rPanel.rpImg.gameObject.SetActive(false);
            input.gameObject.SetActive(false);
            header.text = crafter.recipeSelected.description.Name;
            recipeAvatar.GetComponent <Button>().enabled = false;
            recipeAvatar.sprite = crafter.recipeSelected.description.sprite;
            StopPoppingAnim();
        }
        else
        {
            ok.GetComponent <RectTransform>().offsetMax = new Vector2(-120, 0);
            rPanel.researchPoints.gameObject.SetActive(true);
            rPanel.rpImg.gameObject.SetActive(true);
            input.gameObject.SetActive(true);
            header.text = "Create your new recipe!";
            if (crafter.isLiquid)
            {
                icons.SetupRecipeIcons(true);
            }
            else
            {
                icons.SetupRecipeIcons(false);
            }
            recipeAvatar.GetComponent <Button>().enabled = true;
            recipeAvatar.sprite = icons.GetRandomIcon(crafter.isLiquid);
            AddEventOnIcon();
            popAnim.Play("IconAvatar_popUp");
            recipeAvatar.GetComponentInChildren <ParticleSystem>().Play();
        }
    }
示例#2
0
 public void ChangeBalance(int amount, bool activeIncome = false)
 {
     money += amount;
     rPanel.SetPanel(this);
     if (amount != 0)
     {
         GameController.instance.buttons.paymentPanel.SetPanel(amount);
     }
     if (amount > 0 && activeIncome)
     {
         GameController.instance.player.finances.AddToRevenue(amount);
     }
     if (amount > 0)
     {
         EventManager.TriggerEvent("OnCollectMoney", amount);
         //add to achievement in google play
         PlayGameScript.IncrementAchievement(GPGSIds.achievement_greed_before_need, amount);
     }
 }
示例#3
0
 public override void SetDescription()
 {
     if (!lockedSprite.activeInHierarchy && !Talent.isUnlocked)
     {
         descriptionPanel.SetPanel(Talent, this);
         researchPanel.SetPanel(Talent);
         resourcePanel.Hide();
     }
     else if (!lockedSprite.activeInHierarchy && Talent.isUnlocked)
     {
         descriptionPanel.SetPanel(Talent, this);
         researchPanel.Hide();
         resourcePanel.SetPanel(Talent.characteristics);
     }
 }