Esempio n. 1
0
        public override void Draw(GameTime gameTime, CameraComponent camera)
        {
            Matrix view = camera.View;
            Matrix projection = camera.Projection;

            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (Effect effect in mesh.Effects)
                {
                    Matrix world = transforms[mesh.ParentBone.Index]
                        * Matrix.CreateScale(modelParams.size)
                        * Matrix.CreateTranslation(localOffset)
                        * currentRot
                        * rotation
                        * Matrix.CreateTranslation(physicalData.Position);
                    effect.Parameters["World"].SetValue(world);
                    effect.Parameters["ViewProj"].SetValue(view * projection);
                    effect.Parameters["InverseWorld"].SetValue(Matrix.Invert(world));

                    effect.Parameters["lightPositions"].SetValue(camera.lightPositions);

                }
                mesh.Draw();
            }
        }
Esempio n. 2
0
        public override void Initialize()
        {
            camera = Game.Services.GetService(typeof(CameraComponent)) as CameraComponent;

            systems.Add(typeof(AnimatedFireExplosionSystem), new AnimatedFireExplosionSystem(Game, Game.Content));
            systems.Add(typeof(BeerGlowSystem), new BeerGlowSystem(Game, Game.Content));
            systems.Add(typeof(BeerExplosion), new BeerExplosion(Game, Game.Content));
            systems.Add(typeof(VomitSystem), new VomitSystem(Game, Game.Content));
            systems.Add(typeof(SmokeSystem), new SmokeSystem(Game, Game.Content));

            foreach (KeyValuePair<Type, ParticleSystem> k in systems)
            {
                k.Value.Initialize();
            }
        }
Esempio n. 3
0
        public ParticleEmitter(CameraComponent camera, ParticleSystem particleSystem,
                               float particlesPerSecond, Vector3 initialPosition, Vector3 offset, int attachIndex)
        {
            this.camera         = camera;
            this.particleSystem = particleSystem;

            timeBetweenParticles = 1.0f / particlesPerSecond;

            previousPosition = initialPosition;

            rand        = new Random();
            this.offset = offset;

            this.BoneIndex = attachIndex;

            Timed = false;
            Dead  = false;
        }
Esempio n. 4
0
        public ParticleEmitter(CameraComponent camera, ParticleSystem particleSystem,
                       float particlesPerSecond, Vector3 initialPosition, Vector3 offset, int attachIndex)
        {
            this.camera = camera;
            this.particleSystem = particleSystem;

            timeBetweenParticles = 1.0f / particlesPerSecond;

            previousPosition = initialPosition;

            rand = new Random();
            this.offset = offset;

            this.BoneIndex = attachIndex;

            Timed = false;
            Dead = false;
        }
Esempio n. 5
0
        protected override void Initialize()
        {
            int height = 600;
            int width  = 1000;

            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();



            float maxX   = GraphicsDevice.Viewport.Width;
            float maxY   = GraphicsDevice.Viewport.Height;
            float xRatio = maxX / 600;
            float yRatio = maxY / 1000;

            average = (xRatio + yRatio) / 2;


            camera = new CameraComponent(this);
            Components.Add(camera);
            Services.AddService(typeof(CameraComponent), camera);

            modelManager = new ModelManager(this);
            Components.Add(modelManager);
            Services.AddService(typeof(ModelManager), modelManager);

            genComponentManager = new GeneralComponentManager(this);
            Components.Add(genComponentManager);
            Services.AddService(typeof(GeneralComponentManager), genComponentManager);

            entities = new EntityManager(this);
            Components.Add(entities);
            Services.AddService(typeof(EntityManager), entities);

            particles = new ParticleManager(this);
            Components.Add(particles);
            Services.AddService(typeof(ParticleManager), particles);

            modelDrawer = new BoundingBoxDrawer(this);

            base.Initialize();
        }
Esempio n. 6
0
        public override void Draw(GameTime gameTime, CameraComponent camera)
        {
            Matrix[] bones = animationPlayer.GetSkinTransforms();

            Matrix view = camera.View;
            Matrix projection = camera.Projection;

                //drawing with toon shader
                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (CustomSkinnedEffect effect in mesh.Effects)
                    {
                        effect.SetBoneTransforms(bones);

                        effect.LightPositions = camera.lightPositions;

                        effect.View = view;
                        effect.Projection = projection;
                    }

                    mesh.Draw();
                }
        }
Esempio n. 7
0
        public override void Draw(GameTime gameTime, CameraComponent camera)
        {
            Matrix[] bones = animationPlayer.GetSkinTransforms();

            Matrix view       = camera.View;
            Matrix projection = camera.Projection;

            //drawing with toon shader
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (CustomSkinnedEffect effect in mesh.Effects)
                {
                    effect.SetBoneTransforms(bones);

                    effect.LightPositions = camera.lightPositions;


                    effect.View       = view;
                    effect.Projection = projection;
                }

                mesh.Draw();
            }
        }
Esempio n. 8
0
 public EntityManager(Game1 game)
     : base(game)
 {
     this.mainGame = game;
     camera = game.Services.GetService(typeof(CameraComponent)) as CameraComponent;
 }
Esempio n. 9
0
 public ModelManager(Game1 game)
     : base(game)
 {
     camera           = game.Services.GetService(typeof(CameraComponent)) as CameraComponent;
     this.UpdateOrder = 3;
 }
Esempio n. 10
0
 public EntityManager(Game1 game)
     : base(game)
 {
     this.mainGame = game;
     camera        = game.Services.GetService(typeof(CameraComponent)) as CameraComponent;
 }
Esempio n. 11
0
 public ModelManager(Game1 game)
     : base(game)
 {
     camera = game.Services.GetService(typeof(CameraComponent)) as CameraComponent;
     this.UpdateOrder = 3;
 }
Esempio n. 12
0
 abstract public void Draw(GameTime gameTime, CameraComponent camera);
Esempio n. 13
0
        protected override void Initialize()
        {
            int height = 600;
            int width = 1000;

            graphics.PreferredBackBufferWidth = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            float maxX = GraphicsDevice.Viewport.Width;
            float maxY = GraphicsDevice.Viewport.Height;
            float xRatio = maxX / 600;
            float yRatio = maxY / 1000;
            average = (xRatio + yRatio) / 2;

            camera = new CameraComponent(this);
            Components.Add(camera);
            Services.AddService(typeof(CameraComponent), camera);

            modelManager = new ModelManager(this);
            Components.Add(modelManager);
            Services.AddService(typeof(ModelManager), modelManager);

            genComponentManager = new GeneralComponentManager(this);
            Components.Add(genComponentManager);
            Services.AddService(typeof(GeneralComponentManager), genComponentManager);

            entities = new EntityManager(this);
            Components.Add(entities);
            Services.AddService(typeof(EntityManager), entities);

            particles = new ParticleManager(this);
            Components.Add(particles);
            Services.AddService(typeof(ParticleManager), particles);

            modelDrawer = new BoundingBoxDrawer(this);

            base.Initialize();
        }
Esempio n. 14
0
 public abstract void Draw(GameTime gameTime, CameraComponent camera);