예제 #1
0
        protected override void PostCreatGameObject(GameObject _gameObject, int _index)
        {
            _gameObject.Position += m_randomScale *
                                    new Vector3((float)m_random.NextDouble(),
                                                (float)m_random.NextDouble(),
                                                (float)m_random.NextDouble());
            // random color
            CatColor color = new CatColor();

            color.SetFromHSV(new Vector4((float)m_random.NextDouble(), 0.9f, 0.8f, 0.0f));
            ModelComponent model = _gameObject.GetComponent(typeof(ModelComponent).ToString())
                                   as ModelComponent;

            if (model != null)
            {
                model.GetCatModelInstance().GetMaterial().SetParameter("BiasColor", color);
            }
        }
예제 #2
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();
                }
            }
        }