// 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 () { BM = this.GetComponent<scr_bagMovement>(); m_frameCounter = 1; GM = GameObject.Find("GameManager").GetComponent<scr_GameManager>(); ISM = GM.GetComponent<scr_IngameSoundManager>(); particleAmount = GM.GetMaxWinParticles(); objectPooler = GameObject.FindGameObjectWithTag("pooler").GetComponent<scr_obp>(); m_exploding = false; }
void Update() { if (Input.GetKeyDown(KeyCode.I)) { ShakeCamera(0.5f, 1f); } if (shakeTimer > 0) { Vector2 shakePos = Random.insideUnitCircle * shakeAmount; transform.position = new Vector3(transform.position.x + shakePos.x, transform.position.y + shakePos.y, transform.position.z); shakeTimer -= Time.deltaTime; } bag = GameObject.FindGameObjectWithTag("bag"); if (bag != null) { BM = bag.GetComponent <scr_bagMovement>(); } if (Input.GetMouseButton(1)) { CameraRightClickPan(); LimitRightClickPan(); m_donePanning = false; m_CameraMovmentPoints.Clear(); } else if (Input.GetMouseButtonUp(1)) { doOnce = true; } if (m_donePanning) { if (m_followBag && bag != null) { FollowBag(m_lockHorizontalMovement); AdjustOrtographicSizeToFitParticles(); } if (Input.GetAxis("Mouse ScrollWheel") != 0) { float value = Input.GetAxis("Mouse ScrollWheel"); CameraMouseWheelScroll(value); } } else { JumpToLastMovementPoint(); OnStartCameraPan(); } //Camera.main.orthographicSize = Mathf.MoveTowards(Camera.main.orthographicSize, OrtographicStartSize, OrotgraphicChangeSpeed); }
void Start() { //FH = GameObject.Find("GameManager").GetComponent<scr_FileHandler>(); BM = GameObject.FindGameObjectWithTag("bag").GetComponent <scr_bagMovement>(); score = transform.Find("score").GetComponent <Text>(); scoreUntillNextMedal = transform.Find("scoreUntillNextMedal").GetComponent <Text>(); scoreMax = transform.Find("scoreMax").GetComponent <Text>(); remainingBags = transform.Find("bagsleft").GetComponent <Text>();; gold = transform.Find("gold").GetComponent <Text>(); //bagsLeft[0] = GameObject.Find("Bag_Wheat1"); //bagsLeft[1] = GameObject.Find("Bag_Wheat2"); //bagsLeft[2] = GameObject.Find("Bag_Wheat3"); //Searching the scene for GameObject potionSelect = GameObject.Find("active0"); for (int i = 0; i < bagsLeft.Length; i++) { bagsLeft[i] = GameObject.Find("bagWheat" + i.ToString()); // Debug.Log("How many bags are left: " + GM.GetRemainingBags()); //Finds active potions } for (int i = 0; i < activePotions.Length; i++) { activePotions[i] = FH.GetEquipedPotions(i); } //SpriteRenderer sr = new SpriteRenderer(); //sr = potionsLeft[i].GetComponent<SpriteRenderer>(); //sr.sprite = potionsSprites[0]; for (int i = 0; i < potionsLeft.Length; i++) { potionsLeft[i] = GameObject.Find("Potion" + i.ToString()); potionsLeft[i].GetComponent <SpriteRenderer>().sprite = potionsSprites[activePotions[i]]; } //for (int i = 0; i < potionsLeft.Length; i++) //{ // potionSelect[i] = GameObject.Find("active" + i.ToString()); // //potionSelect[i].gameObject.SetActive // //potionsLeft[i].GetComponent<SpriteRenderer>().sprite //} }
public void SetBMPointer(scr_bagMovement bm) { BM = bm; }
// Use this for initialization void Awake() { bag = GameObject.FindGameObjectWithTag("bag"); bagMovement = bag.GetComponent <scr_bagMovement>(); }