private IEnumerator OnShootIE() { yield return(new WaitForSeconds(5)); if (m_GameStae == GameStae.Over) { yield break; } if (m_KnifeCount <= 0) { m_GameStae = GameStae.Over; UIViewMgr.Instance.OpenView(UIViewType.Fail); yield break; } }
// Use this for initialization void Start() { MissilePath.Init(); m_GameStae = GameStae.Play; m_View = UISceneCtrl.Instance.Load(UISceneType.Game).GetComponent <UIGameSceneView>(); ChangeSceneCtrl.Instance.Show(ChangeSceneType.Open); UIRockerView.Instance.AddEventOnRocker("rocker", OnRockerEvent); CreateKnife(); RefreshEmitter(m_CurEmitter); m_CurEmitter.Fixed(m_CurKnife); StarCount = -1; m_View.SetUI(m_KnifeCount, Global.CurLevel); m_Star.CollectEvent += OnStarHit; for (int i = 0; i < m_MonsterList.Count; i++) { m_MonsterList[i].DeadEvent += OnMonsterDead; } }
private IEnumerator OnMonsterDeadIE() { if (m_GameStae == GameStae.Over) { yield break; } m_KillMonsterCount++; if (m_KillMonsterCount >= m_MonsterList.Count) { if (m_C != null) { StopCoroutine(m_C); } m_GameStae = GameStae.Over; yield return(new WaitForSeconds(1)); UIViewMgr.Instance.OpenView(UIViewType.Win); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { if (m_GameStae != GameStae.Play) { return; } if (m_PreKnife != null) { Ray r = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(r.origin, Vector2.up, 0.1f); if (hit.collider != null) { Emitter e = hit.collider.GetComponent <Emitter>(); if (e != null && e == m_CurEmitter) { return; } } m_PreKnife.SetUniformMotion(); } } if (m_GameStae == GameStae.Play) { m_CanOverTimer -= Time.deltaTime; if (m_CanOverTimer < 0) { if (m_KnifeCount <= 0) { m_GameStae = GameStae.Over; UIViewMgr.Instance.OpenView(UIViewType.Fail); } } } }