//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; }
// 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 }
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 () { 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; }
public void initializeKeyInWorld(List <GameObject> allSpawns, bool randomPlacement) { scr_GameManager GameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <scr_GameManager>(); if (GameManager.debug) { spawn(GameObject.FindGameObjectWithTag("MasterKeyDebug").transform, false); } else if (randomPlacement) { List <GameObject> validSpawns = new List <GameObject>(); if (keyZonesLinked[zoneCounter]) { foreach (GameObject spawn in allSpawns) { if (spawn.transform.root.CompareTag(zoneTags[zoneCounter])) { validSpawns.Add(spawn); } } keyZonesLinked[zoneCounter++] = true; } else { foreach (GameObject spawn in allSpawns) { if (!spawn.transform.IsChildOf(((Component)this).transform.root)) { validSpawns.Add(spawn); } } } if (validSpawns.Count > 0) { GameObject keySpawnLocation = validSpawns[Random.Range(0, validSpawns.Count)]; spawn(keySpawnLocation.transform, false); allSpawns.Remove(keySpawnLocation); } } else { spawn(spawnLocation, false); } }
void Awake() { extraThrow = false; throwExtraOnce = true; startScale = transform.localScale.x; hasTakenPosInput = false; BagCollider = GetComponent <BoxCollider2D>(); BagCollider.isTrigger = true; GM = GameObject.Find("GameManager").GetComponent <scr_GameManager>(); CS = Camera.main.GetComponent <scr_CameraScript>(); PS = GetComponent <ParticleSystem>(); PSGold = GameObject.Find("goldPickup").GetComponent <ParticleSystem>(); if (GameObject.Find("BagBoundaries").GetComponent <BoxCollider2D>() != null) { bagThrowBoundaries = GameObject.Find("BagBoundaries").GetComponent <BoxCollider2D>(); } else { Debug.LogError("BagBoundaries need BoxCollider2D"); } aimingArrow = GameObject.FindGameObjectWithTag("aimarrow"); aimingArrow.SetActive(false); BS = BagState.idle; bag = this.gameObject; bagRB = bag.GetComponent <Rigidbody2D>(); bagRB.isKinematic = true; SP = gameObject.GetComponent <spawnParticles>(); PS.Stop(); PSGold.Stop(); bagMaterial = bag.GetComponent <BoxCollider2D>().sharedMaterial; bagMaterial.bounciness = bouncePower; remainingBounces = bounces; ISG = GameObject.Find("GameManager").GetComponent <scr_IngameSoundManager>(); }
// Start is called before the first frame update void Start() { GameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <scr_GameManager>(); }
// Use this for initialization void Start() { GM = GetComponent <scr_GameManager>(); CS = GameObject.Find("PopUpMenu").GetComponent <scr_CanvasStuff>(); }
// Use this for initialization void Start() { buildingType = buildings.none; isBuilding = false; spriteRenderer = GetComponent <SpriteRenderer>(); gameManager = GameObject.Find("GameManager"); gmScript = gameManager.GetComponent <scr_GameManager>(); levelGen = gameManager.GetComponent <scr_GameManager>().levelGen; levelScript = levelGen.GetComponent <scr_LevelGenerator>(); level = levelScript.level; //set sprite int _i; switch (tileType) { case tile.empty: _i = 0; if ((int)Random.Range(0, 10) == 0) { _i = (int)Random.Range(1, tileSea.Length); spriteRenderer.sprite = tileSea[_i]; } else { spriteRenderer.sprite = tileSea[0]; } break; case tile.floor: _i = 0; if ((int)Random.Range(0, 10) == 0) { _i = (int)Random.Range(0, tileDirt.Length); spriteRenderer.sprite = tileDirt[_i]; } else { spriteRenderer.sprite = tileDirt[0]; } break; case tile.forest: _i = (int)Random.Range(0, tileTree.Length); spriteRenderer.sprite = tileTree[_i]; break; case tile.stone: spriteRenderer.sprite = tileStone; break; case tile.gold: spriteRenderer.sprite = tileGold; break; default: spriteRenderer.sprite = tileNULL; break; } GameObject go; #region SeaEdge //check Sea Edge if (level[x, y] == 0) { if (x != levelScript.gridX - 1) { if (level[x + 1, y] != 0) { go = new GameObject("edge_Right"); go.AddComponent <SpriteRenderer>().sprite = tileEdge[0]; go.GetComponent <SpriteRenderer>().sortingOrder = 1; go.transform.position = transform.position; go.transform.parent = transform; } } if (x != 0) { if (level[x - 1, y] != 0) { go = new GameObject("edge_Left"); go.AddComponent <SpriteRenderer>().sprite = tileEdge[1]; go.GetComponent <SpriteRenderer>().sortingOrder = 1; go.transform.position = transform.position; go.transform.parent = transform; } } if (y != levelScript.gridY - 1) { if (level[x, y + 1] != 0) { go = new GameObject("edge_Top"); go.AddComponent <SpriteRenderer>().sprite = tileEdge[2]; go.GetComponent <SpriteRenderer>().sortingOrder = 1; go.transform.position = transform.position; go.transform.parent = transform; } } if (y != 0) { if (level[x, y - 1] != 0) { go = new GameObject("edge_Bottom"); go.AddComponent <SpriteRenderer>().sprite = tileEdge[3]; go.GetComponent <SpriteRenderer>().sortingOrder = 1; go.transform.position = transform.position; go.transform.parent = transform; } } } #endregion }