Example #1
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();
        }
Example #2
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);
        }