예제 #1
0
        public void OnSuccess()
        {
            MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
            MovieClip       movieClip       = motionDelegator.AddMovieClip();

            movieClip.AppendMotion(Mgr <GameEngine> .Singleton.TimeScaleRef, new CatFloat(1.0f), 1000);
            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.2f), time,
                                    1000);
            }
            PostProcessColorAdjustment colorAdjustment =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessColorAdjustment).ToString())
                as PostProcessColorAdjustment;

            if (colorAdjustment != null)
            {
                movieClip.AddMotion(colorAdjustment.IllumiateRef, new CatFloat(0.0f), time, 1000);
            }
            PostProcessVignette vignette =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessVignette).ToString())
                as PostProcessVignette;

            if (vignette != null)
            {
                movieClip.AddMotion(vignette.RadiusRef, new CatVector2(0.0f, 1.6f), time, 1000);
            }
            movieClip.Initialize();
        }
예제 #2
0
        public void OnFail()
        {
            m_isInQTE = false;
            MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
            MovieClip       movieClip       = motionDelegator.AddMovieClip();

            movieClip.AppendMotion(Mgr <GameEngine> .Singleton.TimeScaleRef, new CatFloat(1.0f), 500);
            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.2f), time,
                                    500);
            }
            PostProcessVignette vignette =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessVignette).ToString())
                as PostProcessVignette;

            if (vignette != null)
            {
                movieClip.AddMotion(vignette.RadiusRef, new CatVector2(0.0f, 1.4f), time, 500);
            }
            movieClip.Initialize();
        }
예제 #3
0
        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);
        }
예제 #4
0
        private void DoAct()
        {
            MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
            MovieClip       movieClip       = motionDelegator.AddMovieClip();
            // logo
            ModelComponent logoModel =
                ModelComponent.GetModelOfGameObjectInCurrentScene(m_logoObjectName);

            if (logoModel != null)
            {
                movieClip.AppendMotion(
                    logoModel.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f),
                    2000);
                movieClip.AppendEmptyTime(2000);
                movieClip.AppendMotion(
                    logoModel.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(0.0f),
                    2000);
            }
            // intro
            ModelComponent introModel =
                ModelComponent.GetModelOfGameObjectInCurrentScene(m_introObjectName);

            if (introModel != null)
            {
                movieClip.AppendMovieClip(new PlayMusic(m_musicName));
                movieClip.AppendMotion(
                    introModel.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f),
                    2000);
                movieClip.AppendEmptyTime(3000);
            }

            // storm
            int             timestamp = movieClip.GetEditCurClip();
            ParticleEmitter emitter   =
                ParticleEmitter.GetParticleEmitterOfGameObjectInCurrentScene(m_emitterObjectName);

            if (emitter != null)
            {
                movieClip.AppendMovieClip(new StormOn(emitter));
                movieClip.AppendMotion(emitter.GenerateRatePerSecondRef,
                                       new CatInteger(512), 5000);
            }

            // Screen bright
            PostProcessColorAdjustment colorAdjustment =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessColorAdjustment).ToString())
                as PostProcessColorAdjustment;

            if (colorAdjustment != null)
            {
                movieClip.AddMotion(colorAdjustment.IllumiateRef, new CatFloat(1.0f), timestamp, 5000);
            }
            movieClip.AppendMovieClip(new SwitchScene(m_nextSceneName));
            movieClip.Initialize();
        }
예제 #5
0
        private void DoAct()
        {
            PostProcessColorAdjustment colorAdjustment =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(
                    typeof(PostProcessColorAdjustment).ToString())
                as PostProcessColorAdjustment;

            if (colorAdjustment != null)
            {
                MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
                MovieClip       movieClip       = motionDelegator.AddMovieClip();
                movieClip.AppendMotion(colorAdjustment.IllumiateRef,
                                       new CatFloat(0.0f), 2000);
                movieClip.Initialize();
            }
        }
예제 #6
0
        protected override void Exit(Fixture _fixtureA, Fixture _fixtureB)
        {
            if (_fixtureA.UserData == null && _fixtureB.UserData == null)
            {
                return;
            }
            ModelComponent modelComponent =
                m_gameObject.GetComponent(typeof(ModelComponent).ToString())
                as ModelComponent;

            if (modelComponent != null)
            {
                MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
                MovieClip       movieClip       = motionDelegator.AddMovieClip();
                movieClip.AppendMotion(
                    modelComponent.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(0.0f), 10000);
                movieClip.Initialize();
            }
        }
예제 #7
0
        private void DoAct()
        {
            ModelComponent model = ModelComponent.GetModelOfGameObjectInCurrentScene(m_introGameObjectName);

            if (model != null)
            {
                MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
                MovieClip       movieClip       = motionDelegator.AddMovieClip();

                movieClip.AppendMotion(
                    model.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f),
                    2000);
                movieClip.AppendEmptyTime(2000);
                movieClip.AppendMotion(
                    model.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(0.0f),
                    2000);

                movieClip.Initialize();
            }
        }
예제 #8
0
        protected override bool Enter(Fixture _fixtureA, Fixture _fixtureB, Contact _contact)
        {
            if (_fixtureA.UserData == null && _fixtureB.UserData == null)
            {
                return(true);
            }

            PostProcessColorAdjustment colorAdjustment =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(
                    typeof(PostProcessColorAdjustment).ToString())
                as PostProcessColorAdjustment;

            if (colorAdjustment != null)
            {
                MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
                MovieClip       movieClip       = motionDelegator.AddMovieClip();
                movieClip.AppendMotion(colorAdjustment.IllumiateRef, new CatFloat(-1.0f), 3000);
                movieClip.Initialize();
            }

            Mgr <CatProject> .Singleton.SoundManager.PlayMusic("music\\" + m_wonderMusic, true, true, 5.0f, 2.0f);

            return(true);
        }
예제 #9
0
        protected override bool Enter(Fixture _fixtureA, Fixture _fixtureB, Contact _contact)
        {
            if (_fixtureA.UserData == null && _fixtureB.UserData == null)
            {
                return(true);
            }

            UIMessageBox msgBox =
                m_gameObject.GetComponent(typeof(UIMessageBox).ToString())
                as UIMessageBox;

            if (msgBox != null)
            {
                msgBox.DoShow(this);
                // do pause
                MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
                MovieClip       movieClip       = motionDelegator.AddMovieClip();
                movieClip.AppendMotion(Mgr <GameEngine> .Singleton.TimeScaleRef, new CatFloat(0.1f), 1000);
                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.94f), time,
                                        1000);
                }
                PostProcessColorAdjustment colorAdjustment =
                    Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessColorAdjustment).ToString())
                    as PostProcessColorAdjustment;

                if (colorAdjustment != null)
                {
                    movieClip.AddMotion(colorAdjustment.IllumiateRef, new CatFloat(-0.6f), time, 1000);
                }
                PostProcessVignette vignette =
                    Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessVignette).ToString())
                    as PostProcessVignette;

                if (vignette != null)
                {
                    movieClip.AddMotion(vignette.RadiusRef, new CatVector2(0.0f, 0.6f), time, 1000);
                }
                movieClip.Initialize();
            }

            // barrier on
            GameObject barrierGenerater =
                Mgr <Scene> .Singleton._gameObjectList.GetOneGameObjectByName(m_barrierGeneraterName);

            if (barrierGenerater != null)
            {
                EndlessBlock eb =
                    barrierGenerater.GetComponent(typeof(EndlessBlock).ToString())
                    as EndlessBlock;
                if (eb != null)
                {
                    eb.BarrierOn = true;
                }
            }

            return(true);
        }
예제 #10
0
        public void OnSuccess()
        {
            m_isInQTE = false;
            m_sucess  = true;
            // go normal
            MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
            MovieClip       movieClip       = motionDelegator.AddMovieClip();

            movieClip.AppendMotion(Mgr <GameEngine> .Singleton.TimeScaleRef, new CatFloat(1.0f), 500);
            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.2f), time,
                                    500);
            }
            PostProcessVignette vignette =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(typeof(PostProcessVignette).ToString())
                as PostProcessVignette;

            if (vignette != null)
            {
                movieClip.AddMotion(vignette.RadiusRef, new CatVector2(0.0f, 1.4f), time, 500);
            }
            movieClip.Initialize();
            // change color
            Random   random = new Random();
            CatColor color  = new CatColor();

            color.SetFromHSV(new Vector4((float)random.NextDouble(), 0.9f, 0.8f, 0.0f));
            ModelComponent parentModel = m_gameObject.GetComponent(typeof(ModelComponent).ToString())
                                         as ModelComponent;

            if (parentModel != null)
            {
                parentModel.GetCatModelInstance().GetMaterial().SetParameter("BiasColor", color);
            }
            // long tail
            if (m_gameObject.Children != null && m_gameObject.Children.Count > 0)
            {
                GameObject      emit    = m_gameObject.Children[0];
                ParticleEmitter emitter = emit.GetComponent(
                    typeof(ParticleEmitter).ToString()) as ParticleEmitter;
                emitter.ParticleLifetimeInMS = 400;

                ModelComponent childModel = emit.GetComponent(typeof(ModelComponent).ToString())
                                            as ModelComponent;
                if (childModel != null)
                {
                    childModel.GetCatModelInstance().GetMaterial().SetParameter("BiasColor", color);
                }
            }
            // add score
            GameObject scoreboardGameObject = Mgr <Scene> .Singleton._gameObjectList.
                                              GetOneGameObjectByName(m_scoreboardGameObjectName);

            if (scoreboardGameObject != null)
            {
                HorseScoreboard scoreboard =
                    scoreboardGameObject.GetComponent(typeof(HorseScoreboard).ToString())
                    as HorseScoreboard;
                if (scoreboard != null)
                {
                    scoreboard.AddScore();
                }
            }
        }
예제 #11
0
        protected override bool Enter(Fixture _fixtureA, Fixture _fixtureB, Contact _contact)
        {
            if (_fixtureA.UserData == null && _fixtureB.UserData == null)
            {
                return(true);
            }

            // stop walking and disable camera follower
            GameObject player = Mgr <Scene> .Singleton._gameObjectList.
                                GetOneGameObjectByName(m_playerName);

            if (player != null)
            {
                HorseController controller = player.GetComponent(
                    typeof(HorseController).ToString()) as HorseController;
                if (controller != null)
                {
                    controller.MotorSpeed = 0.0f;
                }
                CameraFollower cameraFollower = player.GetComponent(
                    typeof(CameraFollower).ToString()) as CameraFollower;
                if (cameraFollower != null)
                {
                    cameraFollower.Enable = false;
                }
            }

            // light candle
            List <string> candles = Mgr <Scene> .Singleton.
                                    _gameObjectList.GetGameObjectsGuidByName(m_candleName);

            foreach (string guid in candles)
            {
                GameObject candle = Mgr <Scene> .Singleton._gameObjectList.GetItem(guid);

                GameObject      fire            = candle.Children[0];
                ParticleEmitter particleEmitter = fire.GetComponent(
                    typeof(ParticleEmitter).ToString()) as ParticleEmitter;
                if (particleEmitter != null)
                {
                    particleEmitter.IsEmitting = true;
                }
            }

            int lightDurationInMS = 200;
            // screen light
            MotionDelegator motionDelegator = Mgr <CatProject> .Singleton.MotionDelegator;
            MovieClip       movieClip       = motionDelegator.AddMovieClip();

            PostProcessColorAdjustment colorAdjustment =
                Mgr <Scene> .Singleton.PostProcessManager.GetPostProcess(
                    typeof(PostProcessColorAdjustment).ToString())
                as PostProcessColorAdjustment;

            movieClip.AppendMotion(colorAdjustment.IllumiateRef, new CatFloat(1.0f), lightDurationInMS);
            // show cake
            GameObject cake = Mgr <Scene> .Singleton._gameObjectList.
                              GetOneGameObjectByName(m_cakeName);

            if (cake != null)
            {
                ModelComponent modelComponent =
                    cake.GetComponent(typeof(ModelComponent).ToString())
                    as ModelComponent;
                movieClip.AddMotion(
                    modelComponent.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f),
                    movieClip.GetStartTick(),
                    lightDurationInMS);
            }
            // screen dark
            movieClip.AppendMotion(colorAdjustment.IllumiateRef, new CatFloat(0.0f), lightDurationInMS);

            // camera up
            int    cameraUpTime = movieClip.GetEditCurClip();
            Camera camera       = Mgr <Camera> .Singleton;

            camera.ForceUpdateMatrixByCameraUpdate = true;
            camera.TargetObject = null;
            if (m_finalCameraPositionObjectName != "")
            {
                GameObject finalPosition =
                    Mgr <Scene> .Singleton._gameObjectList.GetOneGameObjectByName(
                        m_finalCameraPositionObjectName);

                if (finalPosition != null)
                {
                    movieClip.AppendEmptyTime(3000);
                    cameraUpTime = movieClip.GetEditCurClip();
                    movieClip.AppendMotion(camera.TargetPositionRef,
                                           new CatVector3(finalPosition.AbsPosition), 8000,
                                           AnimationClip.PlayMode.CLAMP,
                                           0.0f,
                                           MotionDelegatorPack.AccelerationMode.AccelerateNDecelerate);
                }
            }

            // show wish
            int            wishTime  = cameraUpTime + 5000;
            ModelComponent wishModel =
                ModelComponent.GetModelOfGameObjectInCurrentScene(m_wishObjectName);

            if (wishModel != null)
            {
                movieClip.AddMotion(
                    wishModel.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f), wishTime, 2000);
            }
            int            hbTime  = wishTime + 3000;
            ModelComponent hbModel =
                ModelComponent.GetModelOfGameObjectInCurrentScene(m_hbObjectName);

            if (hbModel != null)
            {
                movieClip.AddMotion(
                    hbModel.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f), hbTime, 2000);
            }
            int            escTime  = hbTime + 3000;
            ModelComponent escModel =
                ModelComponent.GetModelOfGameObjectInCurrentScene(m_quitObjectName);

            if (escModel != null)
            {
                movieClip.AddMotion(
                    escModel.GetCatModelInstance().GetMaterial().GetParameter("Alpha"),
                    new CatFloat(1.0f), escTime, 2000);
            }

            // speed up firework
            if (m_fireworkControllerName != "")
            {
                GameObject firework =
                    Mgr <Scene> .Singleton._gameObjectList.GetOneGameObjectByName(
                        m_fireworkControllerName);

                if (firework != null)
                {
                    FireworkController fc =
                        firework.GetComponent(typeof(FireworkController).ToString())
                        as FireworkController;
                    if (fc != null)
                    {
                        fc.IntervalInMS = 100;
                    }
                }
            }

            movieClip.Initialize();
            return(true);
        }