// Use this for initialization void Start() { GM = GameObject.Find("GameManager").GetComponent <scr_GameManager>(); BM = GameObject.FindGameObjectWithTag("bag").GetComponent <scr_bagMovement>(); ISM = GM.GetComponent <scr_IngameSoundManager>(); pooler = GameObject.FindGameObjectWithTag("pooler").GetComponent <scr_obp>(); FH = GM.GetComponent <scr_FileHandler>(); PE = GM.GetComponent <scr_PotionEffects>(); collectedParticles = 0; m_particle_1_score = GM.GetParticleScore(0); m_particle_2_score = GM.GetParticleScore(1); m_particle_3_score = GM.GetParticleScore(2); //The actual amount of particles; maxParticles = GM.GetMaxWinParticles() * GM.GetMaxBagAmount(); maxScore = maxParticles * (int)m_particle_2_score; //Håkans particle systems for when particles enters the glassjar emitPosition1 = transform.GetChild(0); PS1 = emitPosition1.GetComponent <ParticleSystem>(); PS1.Stop(); emitPosition2 = transform.GetChild(1); PS2 = emitPosition2.GetComponent <ParticleSystem>(); PS2.Stop(); emitPosition3 = transform.GetChild(2); PS3 = emitPosition3.GetComponent <ParticleSystem>(); PS3.Stop(); //End Håkans potions }
//0. NONE //1. SuperBounce Potion: //- Makes the bag increase in velocity for three bounces. Get 25% more velocity instead of slowing down for 3 bounces. (Make sure bag doesn’t clip out of level.) //2. Gigantic Potion: //- Grain Size (and hitbox) increased by 50%. //3. Miniature Potion: //- Grain size (and hitbox) reduced by 50%. //4. Success Potion. //- Any gold picked up is increased by 50%. //5. Presence Potion. //- Gives the player a chance to change the direction that the bag is travelling by clicking around the bag. //6. Iron Potion. //- Grain falls incredibly quickly and doesn’t bounce. //7. Score Potion. //- Adds 5% of the scores total again. //8. Slow Motion Potion. //- Bag and grain move in slow-motion. (50% of normal speed.) void Start() { FH = GetComponent <scr_FileHandler>(); IS = GetComponent <scr_IngameSoundManager>(); GM = GetComponent <scr_GameManager>(); WBH = GameObject.FindGameObjectWithTag("win").GetComponent <scr_winbagBehaviour>(); SP = GameObject.FindGameObjectWithTag("bag").GetComponent <spawnParticles>(); BM = GameObject.FindGameObjectWithTag("bag").GetComponent <scr_bagMovement>(); bag = GameObject.FindGameObjectWithTag("bag"); pooler = GameObject.FindGameObjectWithTag("pooler").GetComponent <scr_obp>(); // none, SuperBounce, Gigantic, Minature, Success, Presence, Iron, Score , Slow_Motion m_potionType[0] = PotionType.none; m_potionType[1] = PotionType.SuperBounce; m_potionType[2] = PotionType.Gigantic; m_potionType[3] = PotionType.Minature; m_potionType[4] = PotionType.Success; m_potionType[5] = PotionType.Presence; m_potionType[6] = PotionType.Iron; m_potionType[7] = PotionType.Score; m_potionType[8] = PotionType.Slow_Motion; m_bouncePower = BM.bouncePower; m_ScaleMultiplier = bag.transform.localScale.x; m_goldMultiplier = 1; m_extraThrow = false; m_gravity = 1.0f; m_scoreEndMultiplier = 1.0f;; m_timeScale = 1; m_drag = bag.GetComponent <Rigidbody2D>().drag; }
void Awake() { WBH = GameObject.FindGameObjectWithTag("win").GetComponent <scr_winbagBehaviour>(); GM = GameObject.Find("GameManager").GetComponent <scr_GameManager>(); FH = GameObject.Find("GameManager").GetComponent <scr_FileHandler>(); }
void Awake() { M_DelayBeforeLvlSwap = 30; PopUpMenu = GameObject.Find("PopUpMenu").GetComponent <Transform>(); CanvasStuff = PopUpMenu.GetComponent <scr_CanvasStuff>(); scaleUpwards = true; activeButton = null; OpenSurveyOnce = true; m_BT = BagType.def; Time.timeScale = 1; m_Camera = Camera.main.GetComponent <scr_CameraScript>(); m_EGS = EndGameState.none; ISM = GetComponent <scr_IngameSoundManager>(); PE = GetComponent <scr_PotionEffects>(); FH = GetComponent <scr_FileHandler>(); if (m_bagAmount > 0 && !GameObject.FindGameObjectWithTag("bag")) { Instantiate(bag, m_bagSpawnPos.position, Quaternion.identity); bag.SetActive(true); m_bagAmount -= 1; } m_showEndGameMenu = false; m_DisplayOnce = true; }
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; } } } } }