Ejemplo n.º 1
0
 public void ActivatePotion()
 {
     if (FlowerLibrary.GetPotionAmount(_item.itemName) > 0)
     {
         if (_potionEffect.PotionEffectStart(FPSMovement.playerMovement))
         {
             EventManager.TriggerEvent(EventNameLibrary.DRINK_POTION, new EventParameter()
             {
                 boolParam     = false,
                 materialParam = _potionCameraEffect,
                 floatParam    = _potionDuration,
                 floatParam2   = _potionCameraEffectFadeTime
             });
             FlowerLibrary.IncrementPotion(_item.itemName, -1);
             UpdateUI();
         }
         else
         {
             Debug.Log("Potion already active");
         }
     }
     else
     {
         Debug.Log("Not enough of " + _item.itemName);
     }
 }
Ejemplo n.º 2
0
    void UpdateUI()
    {
        //List<Transform> recipeHolders = new List<Transform>();

        //recipeHolders.AddRange(_pages[0].transform.GetComponentsInChildren<Transform>().Where(x => x.parent == _pages[0].transform));
        //recipeHolders.AddRange(_pages[1].transform.GetComponentsInChildren<Transform>().Where(x => x.parent == _pages[0].transform));


        for (int i = 0; i < _recipieList.Count; i++)
        {
            _recipieList[i].potionAmount.text = FlowerLibrary.GetPotionAmount(_recipieList[i].potionData.itemName).ToString();

            //Debug.LogFormat("Sanity Check RecipeList: {0}", _recipieList[i].ingredientAmount);
            for (int ii = 0; ii < _recipieList[i].ingredientAmount.Length; ii++)
            {
                try
                {
                    _recipieList[i].ingredientAmount[ii].text = string.Format("{0}/{1}",
                                                                              FlowerLibrary.GetFlowerAmount(_recipieList[i].ingredientsData[ii].ingredient.itemName), _recipieList[i].ingredientsData[ii].amount);
                }
                catch (System.NullReferenceException e)
                {
                    Debug.LogErrorFormat("Encountered NullReference in the AlchemyOrganizerV2 during UpdateUI. This was encountered on the {0}th recipe at the {1}th ingredient", i, ii);
                }
            }
        }
    }
Ejemplo n.º 3
0
 void UpdateUI()
 {
     if (textObject != null)
     {
         textObject.text = _item.itemName + "\n x" + FlowerLibrary.GetPotionAmount(_item.itemName);
     }
 }
Ejemplo n.º 4
0
    public void AddPotion()
    {
        FlowerLibrary.IncrementPotion(_item.itemName, 1);
        Debug.Log("Adding one more " + _item.itemName + ", now there are " + FlowerLibrary.GetPotionAmount(_item.itemName));

        for (int i = 0; i < recipe.Count; i++)
        {
            FlowerLibrary.IncrementFlower(recipe[i].ingredient.itemName, -recipe[i].amount);
        }
        UpdateUI();
    }
Ejemplo n.º 5
0
    void UpdateUI()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            PotionLoader potion     = _allPotions[i];
            string       potionName = potion.GetPotionItemData().itemName;

            Transform child = transform.GetChild(i);
            child.GetComponentInChildren <Text>().text = potionName + "\n x" + FlowerLibrary.GetPotionAmount(potionName);

            //go.GetComponent<Button>().onClick.AddListener( delegate { ActivateSelectedRegion(MENU_ACTIVATE_BUTTON); });
        }
    }
Ejemplo n.º 6
0
 void UpdatePotionAvailability(Recipe recipe)
 {
     if (FlowerLibrary.GetPotionAmount(recipe.potionData.itemName) > 0)
     {
         //recipe.potionButton.GetComponent<Image>().color = new Color(0.4f, 0.75f, 0.25f, 0.5f);
         recipe.potionButton.GetComponent <Button>().enabled = true;
     }
     else
     {
         //recipe.potionButton.GetComponent<Image>().color = new Color(0.35f, 0.35f, 0.35f, 0.5f);
         recipe.potionButton.GetComponent <Button>().enabled = false;
     }
 }
Ejemplo n.º 7
0
    void SetUpRegions()
    {
        regionPositions = new Vector3[8];
        for (int i = 0; i < regionPositions.Length; i++)
        {
            float sinValue = Mathf.Sin((6.28f / 8) * i);
            float cosValue = Mathf.Cos((6.28f / 8) * i);

            regionPositions[i] = new Vector3(sinValue, cosValue, 0);
        }

        if (8 < _allPotions.Count)
        {
            Debug.LogError("Either all potions don't have regions or all regions don't have a potion in PotionWheelManager");
        }
        else
        {
            for (int i = 0; i < _allPotions.Count; i++)
            {
                PotionLoader potion     = _allPotions[i];
                string       potionName = potion.GetPotionItemData().itemName;
                //int ind = i;

                GameObject go = Instantiate(_wheelRegion, transform);
                go.transform.position = transform.position + regionPositions[i] * regionDistanceFromCenter * Camera.main.pixelHeight / 2;
                Debug.Log("Potion wheel region distance: " + regionDistanceFromCenter * Camera.main.pixelHeight);
                //GameObject image = Instantiate(_wheelRegion, go.transform);

                go.GetComponentInChildren <Text>().text = potionName + "\n x" + FlowerLibrary.GetPotionAmount(potionName);
                Image imageSprite = go.transform.GetChild(0).GetComponent <Image>();
                imageSprite.sprite = potion.GetPotionItemData().itemIcon;

                go.name = i.ToString() + "Potion ";
                //go.GetComponent<Button>().onClick.AddListener( delegate { ActivateSelectedRegion(MENU_ACTIVATE_BUTTON); });
            }
        }
    }
Ejemplo n.º 8
0
 void Start()
 {
     imageObject.sprite = _item.itemIcon;
     textObject.text    = _item.itemName + "\n x" + FlowerLibrary.GetPotionAmount(_item.itemName);
 }