void OnTriggerEnter2D(Collider2D coll) { GameBlock gameBlock = coll.gameObject.GetComponent <GameBlock>(); if (gameBlock != null) { if (!gameBlock.bDestroy && !gameBlock.pos.IsEquals(pos)) { gameBlock.bByItemBlock = true; gameBlock.Explosion(false); } if (gameBlock.type == GameBlockType.Item) { if (!gameBlock.bDestroy) { isFinish = false; gameBlock.Explosion(false); } } } }
IEnumerator ClearEffect(bool bSuccess) { if (bSuccess) { List <int> indexList = new List <int>(); for (int i = 0; i < 25; i++) { indexList.Add(i); } BlockTools.Shuffle(indexList); BlockSpawnManager.Instance.MoveStop(10f); InGameManager.instance.MoveStop(10f); if (25 - GetItemBlockCount() < MissionManager.Instance.blockCount) {//남은 블록개수가 아이템으로 바꿔줘야 하는 블록보다 많은 경우 MissionManager.Instance.blockCount = 25 - GetItemBlockCount(); } List <int> fxList = new List <int>(); for (int i = 0; i < 25; i++) { if (MissionManager.Instance.blockCount.CompareTo(0) == 0) { break; } if (fxList.Contains(indexList[i])) { continue; } GameBlock gameBlock = positionList[indexList[i]].GetComponentInChildren <GameBlock>(); if (gameBlock.type == GameBlockType.Color || gameBlock.type == GameBlockType.Gray) { CreateStar(indexList[i], gameBlock); fxList.Add(indexList[i]); yield return(new WaitForSeconds(0.1f)); } } yield return(new WaitForSeconds(2f)); //BlockSpawnManager.Instance.MoveStart(); //MoveStart(); for (int i = 0; i < 25; i++) { GameBlock gameBlock = positionList[indexList[i]].GetComponentInChildren <GameBlock>(); if (gameBlock != null) { if (gameBlock.type == GameBlockType.Item) { gameBlock.Explosion(true); break; } } } while (GetItemBlockCount() > 0) { yield return(new WaitForEndOfFrame()); if (CheckMoveBlock()) { continue; } //if (bDelay) continue; for (int i = 0; i < 25; i++) { GameBlock gameBlock = positionList[indexList[i]].GetComponentInChildren <GameBlock>(); ItemBlock itemBlock = null; if (gameBlock != null) { if (gameBlock.type == GameBlockType.Item) { if (gameBlock.bDestroy) { continue; } yield return(null); //Debug.Log("ClearEffect : " + gameBlock.pos.ToString2()); if (gameBlock == null) { continue; } itemBlock = gameBlock.GetComponent <ItemBlock>(); gameBlock.Explosion(true); switch (itemBlock.itemType) { case ItemType.Bomb: InGameManager.instance.MoveStop(0.84f); BlockSpawnManager.Instance.MoveStop(0.84f); //yield return new WaitForSeconds(2f); break; case ItemType.Horizental: case ItemType.Vertical: InGameManager.instance.MoveStop(0.42f); BlockSpawnManager.Instance.MoveStop(0.42f); //yield return new WaitForSeconds(2f); break; } break; } } } yield return(new WaitForSeconds(0.2f)); } yield return(new WaitForSeconds(1f)); rocket.Fire(2); } else//gameover { SoundManager.Instance.StopBGM(); SoundManager.Instance.PlayEffect("eff_alert"); FuelManager.Instance.AllLock(false); SoundManager.Instance.PlayEffect("eff_electrical_sparks"); yield return(new WaitForSeconds(2f)); FX_Smoke_Black.SetActive(true); MissionManager.Instance.MissionPanelOff(); yield return(new WaitForSeconds(1f)); FX_Electric.gameObject.SetActive(true); FX_Electric.Play(); SoundManager.Instance.PlayEffect("eff_plasma"); FX_Electric.gameObject.GetComponent <FXLoop>().loopTime = 1.3f; FX_Electric.gameObject.GetComponent <FXLoop>().bLoop = true; rocket.randomBounce.Bounce(); FX_Electric_Bridge.SetActive(true); yield return(new WaitForSeconds(1f)); } MissionManager.Instance.missionParent.gameObject.SetActive(false); RectTransform rTr = rocket.gameObject.GetComponent <RectTransform>(); SoundManager.Instance.PlayEffect("eff_rocket_start"); while (rTr.anchoredPosition3D.y < 1000f) { rTr.anchoredPosition3D = Vector3.Lerp(rTr.anchoredPosition3D, new Vector3(0f, 1100f, 0f), Time.deltaTime * rocket.speed); yield return(null); } SoundManager.Instance.StopEffect(SoundName.eff_alert); boardParent.SetActive(false); rocket.gameObject.SetActive(false); fuel.SetActive(false); FX_Electric_Bridge.SetActive(false); FX_Smoke_Black.SetActive(false); FX_Electric.gameObject.SetActive(false); btn_Exit.SetActive(false); ResultManager.Instance.Initialize(bSuccess); }
IEnumerator ExplosionFlow() { SoundManager.Instance.PlayEffect("eff_item_whoosh2"); GetComponent <Animator>().Play("ItemBlock_bombexplosion"); yield return(new WaitForSeconds(0.416f)); SoundManager.Instance.PlayEffect("eff_whoosh"); image.enabled = false; //ParticleManager.Instance.SetParticle(ParticleType.ParticleF, Particle.FX_Rocks, rTr.transform.parent.gameObject.GetComponent<RectTransform>()); GameObject fx_Rocks = PoolManager.Instance.GetPool(PoolType.FX_Rocks).gameObject; ParticleManager.Instance.SetParticle(ParticleType.ParticleF, fx_Rocks, rTr.transform.parent.gameObject.GetComponent <RectTransform>()); int count = missileList.Count; GameObject bomb = transform.Find("Bomb").gameObject; bomb.transform.SetParent(InGameManager.Instance.uiParent.transform); for (int i = 0; i < count; i++) { missileList[i].Setting(); missileList[i].Explosion(); } bool isFinish = true; yield return(new WaitForSeconds(0.416f)); for (int y = pos.y - 1; y < pos.y + 2; y++) { for (int x = pos.x - 1; x < pos.x + 2; x++) { if (BlockTools.ValidPos(new iVector3(x, y, 0))) { if (pos.IsEquals(new iVector3(x, y, 0))) { continue; } GameBlock gameBlock = InGameManager.Instance.GetGameBlock(new iVector3(x, y, 0)); if (gameBlock != null) { if (gameBlock.type == GameBlockType.Item) { if (!gameBlock.bDestroy) { isFinish = false; } } gameBlock.Explosion(false); } } } } bomb.transform.SetParent(transform); bomb.transform.SetAsFirstSibling(); bomb.transform.localPosition = Vector3.zero; bomb.SetActive(false); if (isFinish) { //BlockSpawnManager.Instance.MoveStart(); //InGameManager.Instance.MoveStart(); } MissionManager.Instance.AddBlock(itemType.ToString(), 1); InGameManager.Instance.Respawn(pos); DestroyObject(); }