public void SetPeasants(bool p_isStartBow, float p_peasantIntervals, int p_totalTouchGoal, int p_touchesToBow) { s_touchCounter = 0; m_isStartBow = p_isStartBow; m_peasantIntervals = p_peasantIntervals; s_touchGoal = p_totalTouchGoal; m_touchesToBow = p_touchesToBow; m_aPeasantObjs = new GameObject[m_numOfPeasants]; m_aPeasantScripts = new Peasant[m_numOfPeasants]; m_aPeasantsStartTime = new float[m_numOfPeasants]; EventParameters param = new EventParameters(); param.addParam(EventNames.CURRENT_SCORE, PeasantManager.s_touchCounter); param.addParam(EventNames.CURRENT_GOAL, PeasantManager.s_touchGoal); EventBroadcaster.Instance.notifyObservers(EventNames.ON_SCORE_CHANGED, param); InitPeasantsStartTime(m_peasantIntervals); RandPeasantsStartTime(); SetupPeasants(); }
public override void OnTouchUp() { if (m_bIsTouched) { if (m_isDiver && LevelManager.s_curLevel == 9) { Debug.Log(PeasantManager.s_touchCounter); if (PeasantManager.s_touchCounter < PeasantManager.s_touchGoal - 1) { m_anim.state.SetAnimation(0, "PeasantResist", false); return; } m_touchCounter++; AudioManager.Instance.playSFX(Constants.SFX_GRUNT01); if (m_touchCounter < 30) { m_anim.state.SetAnimation(0, "PeasantResist", false); } else if (m_touchCounter < 40) { m_anim.state.SetAnimation(0, "PeasantStruggle", false); } else if (m_touchCounter < 60) { m_anim.state.SetAnimation(0, "PeasantBleed", false); AudioManager.Instance.stopAllBGM(); StartCoroutine(DelayedGameOver(5.0f)); } return; } if (!m_bIsBowing) { m_touchCounter++; AudioManager.Instance.playSFX(Constants.SFX_GRUNT01); if (m_touchCounter < m_touchesToBow) { GameObject floatingTextObj2 = Instantiate(m_floatingText.gameObject) as GameObject; Transform floatingTextT2 = floatingTextObj2.transform; floatingTextT2.position = transform.position + (Vector3.up * 150.0f); FloatingText floatingText2 = floatingTextObj2.GetComponent <FloatingText>(); floatingText2.setText("!"); } } if (m_touchCounter >= m_touchesToBow) { if (!m_bIsBowing) { PeasantManager.s_touchCounter++; EventParameters param = new EventParameters(); param.addParam(EventNames.CURRENT_SCORE, PeasantManager.s_touchCounter); param.addParam(EventNames.CURRENT_GOAL, PeasantManager.s_touchGoal); EventBroadcaster.Instance.notifyObservers(EventNames.ON_SCORE_CHANGED, param); GameObject floatingTextObj = Instantiate(m_floatingText.gameObject) as GameObject; Transform floatingTextT = floatingTextObj.transform; floatingTextT.position = transform.position + (Vector3.up * 150.0f); FloatingText floatingText = floatingTextObj.GetComponent <FloatingText>(); floatingText.setText(m_touchesToBow.ToString()); //m_touchCounter++; StartCoroutine(ShowPopup()); BowDown(); } } // if(PeasantManager.s_touchCounter >= PeasantManager.s_touchGoal) // { // EventBroadcaster.Instance.notifyObservers(EventNames.ON_GAME_CONTINUE); // levelManager.LoadLevel(); // } m_bIsTouched = false; } }
public void LoadLevel(bool p_incrementLevel = true) { if(s_curLevel == 0) { Instantiate(m_worshipTime); } if(p_incrementLevel) { s_curLevel++; } // if(s_curLevel > 1) // { // EventBroadcaster.Instance.notifyObservers(EventNames.ON_GAME_CONTINUE); // AudioManager.Instance.playSFX(Constants.SFX_ENDCARD02); // } EventParameters param = new EventParameters(); param.addParam(EventNames.CURRENT_LEVEL, s_curLevel); EventBroadcaster.Instance.notifyObservers (EventNames.ON_LEVEL_CHANGED, param); if (s_curLevel == 0) { Level1(); } else if(s_curLevel == 1) { Level2(); } else if (s_curLevel == 2) { Level3(); } else if (s_curLevel == 3) { Level4(); } else if (s_curLevel == 4) { Level5(); } else if (s_curLevel == 5) { Level6(); } else if (s_curLevel == 6) { Level7(); } else if (s_curLevel == 7) { Level8(); } else if (s_curLevel == 8) { Level9(); } else if (s_curLevel == 9) { Level10(); } // else if (s_curLevel == 10) // { // gameOver(); // } }