public void UpadateQTE(int _nonSkewedTimeInMS) { if (m_isInQTE) { if (m_qtePacks.Count > 0) { QTEPack curPack = m_qtePacks.Peek(); // check key KeyboardState keyboardState = Keyboard.GetState(); if (keyboardState.IsKeyDown(curPack.WaitingKey)) { m_qtePacks.Dequeue(); StartKeyOnHead(); } else { // time pass curPack.TimeInMS -= _nonSkewedTimeInMS; if (m_actions != null) { m_actions.Announce(curPack.WaitingKey, curPack.TimeInMS); } if (curPack.TimeInMS <= 0) { OnFail(); } } } else { OnSucess(); } } }
protected override bool Enter(Fixture _fixtureA, Fixture _fixtureB, Contact _contact) { if (m_player != null) { return(true); } if (_fixtureA.UserData == null && _fixtureB.UserData == null) { return(true); } m_player = Mgr <Scene> .Singleton._gameObjectList. GetOneGameObjectByName(m_playerGameObjectName); QTE qte = m_player.GetComponent(typeof(QTE).ToString()) as QTE; if (qte.IsInQTE()) { return(true); } // slow down and blur MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator; MovieClip movieClip = motionDelegator.AddMovieClip(); movieClip.AppendMotion(Mgr <GameEngine> .Singleton.TimeScaleRef, new CatFloat(0.1f), 200); PostProcessMotionBlur motionBlur = Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessMotionBlur).ToString()) as PostProcessMotionBlur; int time = movieClip.GetStartTick(); if (motionBlur != null) { movieClip.AddMotion(motionBlur.BlurIntensityRef, new CatFloat(0.98f), time, 200); } PostProcessVignette vignette = Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessVignette).ToString()) as PostProcessVignette; if (vignette != null) { movieClip.AddMotion(vignette.RadiusRef, new CatVector2(0.0f, 0.9f), time, 200); } movieClip.Initialize(); // qte int qteNum = 1 + m_random.Next(4); for (int i = 0; i < qteNum; ++i) { int randKey = 65 + m_random.Next(90 - 65 + 1); QTEPack qtePack = new QTEPack((Keys)randKey, 800); qte.AppendEvent(qtePack); } qte.StartQTE(this); m_isInQTE = true; return(true); }
private void StartKeyOnHead() { if (m_qtePacks.Count > 0) { QTEPack curPack = m_qtePacks.Peek(); // show the key } else { OnSucess(); } }
public void AppendEvent(QTEPack _qtePack) { m_qtePacks.Enqueue(_qtePack); }