void Start() { potionSelected = false; selectedTransform = null; ableToMove = true; Inventory_BG = transform.FindChild("Inventory_BG"); potion_info_BG = GameObject.Find("potion_info_BG").transform; accept = GameObject.Find("potion_accept").gameObject; decline = GameObject.Find("potion_decline").gameObject; FH = GetComponent <scr_FileHandler>(); m_gold = FH.GetGold(); potion_info_Picture = GameObject.Find("potionPicture").GetComponent <SpriteRenderer>(); potion_info_BG.gameObject.SetActive(false); accept.SetActive(false); decline.SetActive(false); potion_info_Picture.gameObject.SetActive(false); canvas = transform.FindChild("Canvas"); m_texts = new Text[canvas.childCount]; for (int i = 0; i < m_texts.Length; i++) { m_texts[i] = canvas.GetChild(i).GetComponent <Text>(); m_texts[i].enabled = false; } Equipment_BG = transform.FindChild("Equipment_BG"); potion_0_0 = GameObject.Find("potion_0_0").transform; equipmentSlots = GameObject.FindGameObjectsWithTag("slot"); for (int i = 0; i < equipmentSlots.Length; i++) { ES[i] = equipmentSlots[i].GetComponent <scr_EquipmentSlot>(); equipedPotions[i] = FH.GetEquipedPotions(i); } InvetoryPotion[,] potions = FH.GetInventory(); for (int x = 0; x < equipedPotions.Length; x++) { for (int i = 0; i < InventorySize.x; i++) { for (int y = 0; y < InventorySize.y; y++) { InvetoryPotion IP = new InvetoryPotion(); IP.m_potionType = potions[i, y].m_potionType; IP.m_description = potionDescritions[IP.m_potionType]; IP.m_unlocked = potions[i, y].m_unlocked; GameObject obj = (GameObject)Instantiate(l_potionTypes[IP.m_potionType], Inventory_BG); obj.transform.position = new Vector2(potion_0_0.position.x + InvetoryItemSpace.x * i, potion_0_0.position.y - InvetoryItemSpace.y * y); IP.m_obj = obj; IP.m_goldCost = UnityEngine.Random.Range(5, 15); IP.m_bought = potions[i, y].m_bought; IP.m_originalPos = obj.transform.position; if (IP.m_potionType == equipedPotions[x] && ES[x].GetAttachedPotion() == null) { Debug.Log("Setting"); ES[x].SetAttachedPotion(obj); IP.m_unlocked = true; IP.m_bought = true; } l_Inventory.Add(IP); SpriteRenderer sr = IP.m_obj.GetComponent <SpriteRenderer>(); if (!IP.m_bought) { sr.color = new Color(sr.color.r, sr.color.g, sr.color.b, 0.2f); } if (!IP.m_unlocked) { sr.color = Color.black; } } } } }
void Start() { ISM.PlayStageStart(); m_gold = FH.GetGold(); m_delayTimer = 0; }