コード例 #1
0
 private void SetupSpeciesItem(List <SpeciesItem> list, int countSlots)
 {
     for (int i = 0; i < list.Count; ++i)
     {
         var    item   = list[i];
         Sprite sprite = _iconDictionary.GetSprites(item.species)[(int)item.beeType];
         _slots[i].Setup(sprite, item.count, this, SlotStorage.ItemType.SpeciesItem, item, item.beeType);
     }
     ActivateSlots(countSlots);
 }
コード例 #2
0
 public void Setup(Bee bee, string count)
 {
     iconLeft.sprite        = iconDictionary.GetSprites((Species.ValueType)bee.pairs[0].main.GetValue())[(int)bee.type];
     iconRight.sprite       = iconDictionary.GetSprites((Species.ValueType)bee.pairs[0].secondary.GetValue())[(int)bee.type];
     nameText.text          = $"{bee.GetSpecies()} {bee.type}";
     countText.text         = "Count: " + count;
     speciesMainText.text   = ((Species.ValueType)bee.pairs[0].main.GetValue()).ToString();
     speciesSecText.text    = ((Species.ValueType)bee.pairs[0].secondary.GetValue()).ToString();
     speedMainText.text     = ((Speed.ValueType)bee.pairs[1].main.GetValue()).ToString();
     speedSecText.text      = ((Speed.ValueType)bee.pairs[1].secondary.GetValue()).ToString();
     lifeSpanMainText.text  = ((LifeSpan.ValueType)bee.pairs[2].main.GetValue()).ToString();
     lifeSpanSecText.text   = ((LifeSpan.ValueType)bee.pairs[2].secondary.GetValue()).ToString();
     fertilityMainText.text = bee.pairs[3].main.GetValue().ToString();
     fertilitySecText.text  = bee.pairs[3].secondary.GetValue().ToString();
 }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        foreach (var item in BeeList)
        {
            GameObject newSlot    = Instantiate(SlotPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            float      scaleValue = Screen.width / 1080f;
            Vector3    scale      = new Vector3(scaleValue, scaleValue);
            newSlot.transform.localScale = scale;
            newSlot.transform.SetParent(Content);

            SlotStore slotStore = newSlot.GetComponent <SlotStore>();
            slotStore.SetUp($"{item.ValueType} {item.BeeType}", iconDictionary.GetSprites(item.ValueType)[(int)item.BeeType], this);
        }
    }
コード例 #4
0
 public void Click()
 {
     if (state == State.Ready &&
         inventoryManager.listPrincess.Count != 0 &&
         inventoryManager.listDrone.Count != 0)
     {
         bee1 = inventoryManager.GetBee(Random.Range(0, inventoryManager.listPrincess.Count), -1,
                                        BeeType.Princess);
         bee2 = inventoryManager.GetBee(Random.Range(0, inventoryManager.listDrone.Count), -1,
                                        BeeType.Drone);
         //пихаем пчел
         timer.SetTimer(10);
         button.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Забрать";
         transform.GetChild(3).gameObject.SetActive(false);
         transform.GetChild(5).gameObject.GetComponent <Image>().sprite = iconDictionary.GetSprites(bee1.GetSpecies())[(int)BeeType.Queen];
         transform.GetChild(5).gameObject.SetActive(true);
         button.interactable = false;
         state = State.Running;
     }
     else if (state == State.Running)
     {
     }
     else if (state == State.NeedGet)
     {
         inventoryManager.AddBee(new Bee(bee1, bee2, BeeType.Princess));
         for (int i = 0; i < bee1.GetFertility(); ++i)
         {
             inventoryManager.AddBee(new Bee(bee1, bee2, BeeType.Drone));
         }
         transform.GetChild(3).gameObject.SetActive(true);
         transform.GetChild(5).gameObject.SetActive(false);
         //забираем пчел
         button.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Начать";
         state = State.Ready;
     }
 }