Beispiel #1
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (MyModel.get() != null && MyEffect.get() != null)
            {
                Game1.graphicsDevice.BlendState = BlendState.AlphaBlend;
                _3DEffect effect3D = (_3DEffect)MyEffect.Holder;

                effect3D.SetFromObject(this);
                effect3D.SetFromCamera(camera);

                Render.DrawModel(MyModel.get(), MyEffect.get());
            }
            base.Draw3D(camera, DrawTag);
        }
        public override void Update(GameTime gameTime)
        {
            if (MyEffect.get() != null)
            {
                AddParticles(gameTime);

                RetireActiveParticles();
                FreeRetiredParticles();

                if (firstRetiredParticle == firstActiveParticle)
                    drawCounter = 0;
            }

            base.Update(gameTime);
        }
Beispiel #3
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (MyModel.get() != null && MyEffect.get() != null)
            {
                Deferred3DEffect effect3D = (Deferred3DEffect)MyEffect.Holder;
                switch (DrawTag)
                {
                case GameObjectTag._3DDeferredGBuffer:
                {
                    effect3D.SetWorldViewIT(camera, this);
                    effect3D.SetFromObject(this);
                    effect3D.SetFromCamera(camera);
                    effect3D.SetDeferredTechnique();
                    break;
                }

                case GameObjectTag._3DShadow:
                {
                    effect3D.SetFromObject(this);
                    effect3D.SetFromCamera(camera);
                    effect3D.SetShadowTechnique();
                    effect3D.SetLight(Transfer.LightPosition, Transfer.LightDistance);
                    break;
                }

                default:
                {
                    effect3D.SetFromCamera(camera);
                    effect3D.SetUV(camera);

                    if (!UseDeferred.get())
                    {
                        effect3D.SetFromObject(this);
                    }

                    effect3D.SetForwardTechnique();
                    break;
                }
                }

                Render.DrawModel(MyModel.get(), MyEffect.get());
            }
            base.Draw3D(camera, DrawTag);
        }
Beispiel #4
0
 public static void DrawModel(Model model, EffectValue effect, Camera3D camera, Basic3DObject obj)
 {
     if (model != null && effect.get() != null)
     {
         _3DEffect effect3D = (_3DEffect)effect.Holder;
         effect3D.SetFromObject(obj);
         effect3D.SetFromCamera(camera);
         DrawModel(model, effect3D.MyEffect);
     }
 }
Beispiel #5
0
        public override bool TriggerEvent(EventType Event, string[] args)
        {
            if (MyEffect.get() == null)
            {
                return(false);
            }
            else
            {
                if (SpecularParameter == null)
                {
                    SpecularParameter = MyEffect.findEffectParameter("Specular");
                    OldSpecular       = SpecularParameter.GetValueSingle();
                }
                if (ColorParameter == null)
                {
                    ColorParameter = MyEffect.findEffectParameter("Color");
                    OldColor       = ColorParameter.GetValueVector4();
                }
            }

            switch (Event)
            {
            case EventType.Kill:
                Dead.set(true);
                if (args.Count() > 0)
                {
                    float f = Logic.ParseF(args[0]);
                    if (f != 0)
                    {
                        ChangeSpeed.set(f);
                    }
                }
                return(true);

            case EventType.Revive:
                Dead.set(false);
                if (args.Count() > 0)
                {
                    float f = Logic.ParseF(args[0]);
                    if (f != 0)
                    {
                        ChangeSpeed.set(f);
                    }
                }
                return(true);
            }

            return(base.TriggerEvent(Event, args));
        }