void Explode() { gameObject.SetActive(false); List <ComBox> sameBoxs = BoxManager.GetInstance().GetSameBoxs(box); box.Explode(); int c = sameBoxs.Count; if (c == 1) { sameBoxs[0].Explode(); } else if (c > 1) { int same = Random.Range(0, c); sameBoxs[same].Explode(); } GamePlaying.Instance().boxPanel.CheckPanelState(); GamePlaying.Instance().boxPanel.BackMoveSpeed(); GamePlaying.Instance().isPlaying = true; GamePlaying.Instance().boxPanel.m_CanTouch = true; GamePlaying.Instance().boxPanel.isUsingProp = false; GamePlaying.Instance().boxPanel.usingPropID = GamePropsId.None; Messenger.Broadcast(ConstValue.MSG_USE_PROP_SUC, GamePropsId.Same); Destroy(gameObject); }
void Explode() { gameObject.SetActive(false); exp = GameObject.Instantiate(ResourceMgr.Instance().GetResFromName(ConstValue.GAME_BOMB_EXP), transform.position, Quaternion.identity) as GameObject; ParticleSystem ps = exp.GetComponent <ParticleSystem>(); ps.Play(); Invoke("DestoryExp", 1f); List <ComBox> neighborBoxs = BoxManager.GetInstance().GetNeighborBoxs(box); box.Explode(); foreach (ComBox comBox in neighborBoxs) { comBox.Explode(); } GamePlaying.Instance().boxPanel.CheckPanelState(); GamePlaying.Instance().boxPanel.BackMoveSpeed(); GamePlaying.Instance().isPlaying = true; GamePlaying.Instance().boxPanel.m_CanTouch = true; GamePlaying.Instance().boxPanel.isUsingProp = false; GamePlaying.Instance().boxPanel.usingPropID = GamePropsId.None; Messenger.Broadcast(ConstValue.MSG_USE_PROP_SUC, GamePropsId.Bomb); }
void ClickComBox(ComBox hitBox) { if (hitBox.index != 10 && !hitBox.fall) { if (m_SelectBox == null) { m_SelectBox = hitBox; background.transform.localPosition = m_SelectBox.gameObject.transform.localPosition; } else { m_OtherBox = hitBox; if (m_SelectBox != m_OtherBox && m_SelectBox.index == m_OtherBox.index) { List <Vector2> lineList = boxManager.LinkTwoBox(m_SelectBox, m_OtherBox); if (lineList != null) { m_SelectBox.Explode(); m_SelectBox = null; m_OtherBox.Explode(); m_OtherBox = null; background.transform.localPosition = new Vector3(10f, 10f, 0f); DrawLine(lineList); GameStaticData.Combo += 1; CheckPanelState(); } else { GameStaticData.Combo = 0; m_SelectBox = m_OtherBox; background.transform.localPosition = m_SelectBox.gameObject.transform.localPosition; } } else { GameStaticData.Combo = 0; m_SelectBox = m_OtherBox; background.transform.localPosition = m_SelectBox.gameObject.transform.localPosition; } } } }