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 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); }
public void Init() { if (_lock == null) { _lock = new Object(); } m_level = GamePlaying.Instance().currentLevel; m_resource = ResourceMgr.Instance(); speed = 0.005f; moveSpeed = -speed; canLink = true; isLoadDone = false; usingPropID = GamePropsId.None; isUsingProp = false; m_CanTouch = true; boxPanelW = m_level.width * ConstValue.BoxWidth; boxPanelH = m_level.height * ConstValue.BoxHeight; Debug.Log("boxPanelWH:" + boxPanelW + "," + boxPanelH); transform.position = new Vector3(0, ScreenInfo.h / 2 - ConstValue.BoxHeight * visibleRow + boxPanelH / 2, 0); background = Instantiate(m_resource.GetResFromName(ConstValue.GAME_BACKGROUND), new Vector3(10f, 10f, 0), Quaternion.identity) as GameObject; background.transform.parent = transform; boxManager = BoxManager.GetInstance(); boxManager.Init(); bottomRow = m_level.height - 1; InitBoxs(bottomRow, visibleRow); GetBottomBox(); }
void Explode() { gameObject.SetActive(false); leftTrail = GameObject.Instantiate(ResourceMgr.Instance().GetResFromName(ConstValue.GAME_ROCKET_TR), transform.position, Quaternion.identity) as GameObject; leftTrail.GetComponent <RocketTrail>().speed = -0.14f; rightTrail = GameObject.Instantiate(ResourceMgr.Instance().GetResFromName(ConstValue.GAME_ROCKET_TR), transform.position, Quaternion.identity) as GameObject; rightTrail.GetComponent <RocketTrail>().speed = 0.14f; InvokeRepeating("DestoryBox", 0.01f, 0.1f); Invoke("DestoryTrail", 1f); rowBoxs = BoxManager.GetInstance().GetBoxListByRow(box.y); }
public void Explode() { if (ice > 0) { ice = 0; } else { BoxManager.GetInstance().RemoveBox(this); ParticleSystem ps = ExpParticleFactory.Instance().CreateExpParticel(transform.position); //ps.transform.parent = transform.parent; Destroy(gameObject); ps.Play(); } }
public void AddBoxFight() { //取两个位置 List <Vector2> nullPosition = BoxManager.GetInstance().GetTwoNullPosition(); Debug.Log("nullPosition" + nullPosition.Count); foreach (Vector2 v in nullPosition) { Debug.Log("" + v.x + "," + v.y); } Random.seed = (int)System.DateTime.Now.Ticks; if (nullPosition.Count > 1) { int boxId = Random.Range(1, 11); Object boxClone = Instantiate(ResourceMgr.Instance().GetResFromName(ConstValue.GAME_LIAN_PRE + boxId), Vector3.zero, Quaternion.identity); GameObject oneBox = boxClone as GameObject; oneBox.transform.parent = transform; oneBox.transform.position = transform.position; oneBox.GetComponent <ComBox>().fall = true; GameObject secBox = Instantiate(boxClone) as GameObject; secBox.transform.parent = transform; secBox.transform.position = transform.position; secBox.GetComponent <ComBox>().fall = true; int firIndex = Random.Range(0, nullPosition.Count); Vector2 firPos = nullPosition[firIndex]; Debug.Log("firPos " + firPos.x + "," + firPos.y); nullPosition.RemoveAt(firIndex); int secIndex = Random.Range(0, nullPosition.Count); Vector2 secPos = nullPosition[secIndex]; Debug.Log("secPos " + secPos.x + "," + secPos.y); } }