void Start() { checkWin = GameObject.FindObjectOfType <WinLoseGameState>(); tower = GameObject.FindObjectOfType <PowerTower>(); powercheck = GameObject.FindObjectOfType <PowerCellStats>(); TextA = GameObject.Find("GoalsTextA").GetComponent <Text>(); TextB = GameObject.Find("GoalsTextB").GetComponent <Text>(); TextC = GameObject.Find("GoalsTextC").GetComponent <Text>(); TextC1 = GameObject.Find("GoalsTextC1").GetComponent <Text>(); TextC2 = GameObject.Find("GoalsTextC2").GetComponent <Text>(); TextC3 = GameObject.Find("GoalsTextC3").GetComponent <Text>(); greenValue = GameObject.Find("TurretActiveTimeGreen").GetComponent <ChargeLevels>(); redValue = GameObject.Find("TurretActiveTimeRed").GetComponent <ChargeLevels>(); blueValue = GameObject.Find("TurretActiveTimeBlue").GetComponent <ChargeLevels>(); }
//called to destroy vertical matches void DestroyBlackWhite(int x, int y, int z, int w) { PowerTower powerTower = GameObject.Find("PowerTowers").GetComponent <PowerTower>(); if (Blocks[z].tag == Blocks[w].tag) { if (tag == "BlackBlock") { foreach (GameObject block in Blocks) { if (block != null) { block.BroadcastMessage("DestroyOtherBlocks", SendMessageOptions.DontRequireReceiver); } } foreach (ParticleSystem particles in particleComponents) { Debug.Log("Activate Particles"); particles.enableEmission = true; particles.Emit(15); } Destroy(Feelers[x].otherBlock, .3f); Destroy(Feelers[y].otherBlock, .3f); } if (tag == "PowerBlock") { powerTower.AddPower(1); GetComponent <AudioSource>().PlayOneShot(match3SoundFX); } Destroy(Blocks[z], .3f); Destroy(Blocks[w], .3f); Destroy(gameObject, .3f); } }