Exemplo n.º 1
0
    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();
        }
    }