Esempio n. 1
0
 public void DecreaseRespectiveGadgetCounter(GadgetTypes type)
 {
     foreach (GadgetTemplate gadget in gadgets)
     {
         if (gadget.type == type)
         {
             gadget.counter.DecrementCounter();
         }
     }
 }
Esempio n. 2
0
    private Sprite GetRespectiveIcon(GadgetTypes type)
    {
        switch (type)
        {
        case GadgetTypes.FlashBang:

            return(flashBangIcon);


        default:
            return(flashBangIcon);
        }
    }
Esempio n. 3
0
 public void SetUpGadget(GadgetTypes[] gadgets, int primaryAmount, int secondaryAmount)
 {
     //if there is a secondary and primary gadget
     if (gadgets.Length > 1 && gadgets.Length < 3)
     {
         //assign gadgets
         primaryGadget   = gadgets[0];
         secondaryGadget = gadgets[1];
         //Update UI
         UIManager.instance.gadgetDisplay.GenerateNewGadgetTemplate(primaryGadget, primaryAmount);
     }
     else
     {
         //assign gadgets
         primaryGadget = gadgets[0];
         //Update UI
         UIManager.instance.gadgetDisplay.GenerateNewGadgetTemplate(primaryGadget, primaryAmount);
     }
 }
Esempio n. 4
0
    public void GenerateNewGadgetTemplate(GadgetTypes type, int amount)
    {
        GadgetTemplate newTemplate = Instantiate(gadgetTemplatePrefab, transform.position, Quaternion.identity).GetComponent <GadgetTemplate>();

        Debug.Log(newTemplate);
        newTemplate.transform.SetParent(rt.transform);
        RectTransform templateRect   = newTemplate.gameObject.GetComponent <RectTransform>();
        int           positionOffset = gadgets.Count - 1;

        if (templateRect == true)
        {
            Vector2 targetPos = rt.transform.position;


            templateRect.anchoredPosition = new Vector2(taskXOffset * positionOffset, taskYOffset);
        }
        Sprite icon = GetRespectiveIcon(type);

        newTemplate.SetUpTemplate(icon, amount, type);
        gadgets.Add(newTemplate);
    }
Esempio n. 5
0
 public void SetUpTemplate(Sprite icon, int amount, GadgetTypes typeOfGadget)
 {
     counter.SetUpCounter(amount);
     type = typeOfGadget;
     gadgetIcon.sprite = icon;
 }