示例#1
0
        public void CreateRioter(Vector3 loc)
        {
            GameEntity entity = new GameEntity("derper");

            Entity box = new Box(loc, 2f, 4, 2f, 4);

            box.Material.KineticFriction  = 0;
            box.Material.KineticFriction  = 0;
            box.LocalInertiaTensorInverse = new Matrix3X3();
            box.CollisionInformation.CollisionRules.Group = (Game as Game1).guyCollisionGroup;
            entity.AddSharedData(typeof(Entity), box);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            Model           guy   = GetAnimatedModel("Models\\Player\\k_idle1");
            AnimationPlayer anims = new AnimationPlayer(guy.Tag as SkinningData);

            entity.AddSharedData(typeof(AnimationPlayer), anims);

            AnimatedModelComponent graphics = new AnimatedModelComponent(mainGame, entity, guy, 1, Vector3.Down * 2);

            entity.AddComponent(typeof(AnimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            RioterController controller = new RioterController(mainGame, entity);

            entity.AddComponent(typeof(RioterController), controller);
            genComponentManager.AddComponent(controller);

            rioters.Add(entity);
        }
示例#2
0
        public void CreateMailbox2(Vector3 pos)
        {
            GameEntity entity = new GameEntity("prop");

            Entity data = new Box(pos, 2, 3.75f, 2, 200);

            data.CollisionInformation.LocalPosition += Vector3.Down * 1;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent roomPhysics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\mailbox2"), new Vector3(1), Vector3.Down * 2, 0, 0, 0);

            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            MailboxController controller = new MailboxController(mainGame, entity);

            entity.AddComponent(typeof(MailboxController), controller);
            genComponentManager.AddComponent(controller);

            lightPoles.Add(entity);
        }
示例#3
0
        public void CreateBeer(Vector3 loc)
        {
            GameEntity entity = new GameEntity("");

            Entity box = new Box(loc, 6, 2, 6);

            box.CollisionInformation.CollisionRules.Personal = BEPUphysics.CollisionRuleManagement.CollisionRule.NoSolver;
            entity.AddSharedData(typeof(Entity), box);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\beer"), new Vector3(3), Vector3.Zero, 0, 0, 0);

            graphics.AddYawSpeed(.1f);
            graphics.AddEmitter(typeof(BeerGlowSystem), "glow", 8, 0, Vector3.Up * 8);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            BeerController controller = new BeerController(mainGame, entity);

            entity.AddComponent(typeof(BeerController), controller);
            genComponentManager.AddComponent(controller);
        }
示例#4
0
        public void CreateCar(Vector3 pos)
        {
            GameEntity entity = new GameEntity("prop");

            Entity data = new Box(pos, 8, 13, 11, 500);

            data.CollisionInformation.LocalPosition += Vector3.Down * 8;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\jeep"), new Vector3(2, 4, 2), Vector3.Down * 16.5f, 0, 0, 0);

            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            CarController controller = new CarController(mainGame, entity);

            entity.AddComponent(typeof(CarController), controller);
            genComponentManager.AddComponent(controller);

            cars.Add(entity);
        }
示例#5
0
        public void CreateLightPole(Vector3 pos)
        {
            GameEntity entity = new GameEntity("prop");

            Entity data = new Box(pos, 4, 18, 4, 800);

            data.CollisionInformation.LocalPosition += Vector3.Down * 4;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent roomPhysics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\lamp"), new Vector3(4), Vector3.Down * 16.5f, 0, 0, 0);

            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            LightPoleController controller = new LightPoleController(mainGame, entity);

            entity.AddComponent(typeof(LightPoleController), controller);
            genComponentManager.AddComponent(controller);

            camera.AddLightPoleEntity(data);

            lightPoles.Add(entity);
        }
示例#6
0
        public void CreatePlayer()
        {
            GameEntity entity = new GameEntity("player");

            Entity box = new Box(playerSpawn, 2f, 4, 2f, 8);

            box.CollisionInformation.CollisionRules.Group = (Game as Game1).guyCollisionGroup;
            box.PositionUpdateMode        = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;
            box.LocalInertiaTensorInverse = new Matrix3X3();
            entity.AddSharedData(typeof(Entity), box);
            camera.AssignEntity(box);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            Model           playerModel = GetAnimatedModel("Models\\Player\\k_idle1");
            AnimationPlayer anims       = new AnimationPlayer(playerModel.Tag as SkinningData);

            entity.AddSharedData(typeof(AnimationPlayer), anims);

            AnimatedModelComponent graphics = new AnimatedModelComponent(mainGame, entity, playerModel, 1, Vector3.Down * 2);

            entity.AddComponent(typeof(AnimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            PlayerController controller = new PlayerController(mainGame, entity);

            entity.AddComponent(typeof(PlayerController), controller);
            genComponentManager.AddComponent(controller);

            player = entity;
        }
示例#7
0
        public void CreatePunch(Vector3 pos, Vector3 dir, bool player)
        {
            GameEntity entity = new GameEntity("punch");

            Entity data = new Box(pos, .5f, .5f, .5f, 300);

            data.CollisionInformation.CollisionRules.Group = (Game as Game1).punchCollisionGroup;
            data.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;

            data.LinearVelocity = dir * 50;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent roomPhysics = new PhysicsComponent(mainGame, entity);

            entity.AddComponent(typeof(PhysicsComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            PunchController controller = new PunchController(mainGame, entity, player);

            entity.AddComponent(typeof(PunchController), controller);
            genComponentManager.AddComponent(controller);
        }
示例#8
0
        private void CreateSkybox()
        {
            GameEntity entity = new GameEntity("");

            Entity locationHolder = new Box(Vector3.Zero, 0, 0, 0);

            entity.AddSharedData(typeof(Entity), locationHolder);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\skybox"), new Vector3(5), Vector3.Zero, 0, 0, 0);

            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);
        }
示例#9
0
        public void CreateBeer(Vector3 loc)
        {
            GameEntity entity = new GameEntity("");

            Entity box = new Box(loc, 6, 2, 6);
            box.CollisionInformation.CollisionRules.Personal = BEPUphysics.CollisionRuleManagement.CollisionRule.NoSolver;
            entity.AddSharedData(typeof(Entity), box);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\beer"), new Vector3(3), Vector3.Zero, 0, 0, 0);
            graphics.AddYawSpeed(.1f);
            graphics.AddEmitter(typeof(BeerGlowSystem), "glow", 8, 0, Vector3.Up * 8);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            BeerController controller = new BeerController(mainGame, entity);
            entity.AddComponent(typeof(BeerController), controller);
            genComponentManager.AddComponent(controller);
        }
示例#10
0
        private void CreateSkybox()
        {
            GameEntity entity = new GameEntity("");

            Entity locationHolder = new Box(Vector3.Zero, 0, 0, 0);
            entity.AddSharedData(typeof(Entity), locationHolder);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\skybox"), new Vector3(5), Vector3.Zero, 0, 0, 0);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);
        }
示例#11
0
        public void CreateRioter(Vector3 loc)
        {
            GameEntity entity = new GameEntity("derper");

            Entity box = new Box(loc, 2f, 4, 2f, 4);
            box.Material.KineticFriction = 0;
            box.Material.KineticFriction = 0;
            box.LocalInertiaTensorInverse = new Matrix3X3();
            box.CollisionInformation.CollisionRules.Group = (Game as Game1).guyCollisionGroup;
            entity.AddSharedData(typeof(Entity), box);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            Model guy = GetAnimatedModel("Models\\Player\\k_idle1");
            AnimationPlayer anims = new AnimationPlayer(guy.Tag as SkinningData);
            entity.AddSharedData(typeof(AnimationPlayer), anims);

            AnimatedModelComponent graphics = new AnimatedModelComponent(mainGame, entity, guy, 1, Vector3.Down * 2);
            entity.AddComponent(typeof(AnimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            RioterController controller = new RioterController(mainGame, entity);
            entity.AddComponent(typeof(RioterController), controller);
            genComponentManager.AddComponent(controller);

            rioters.Add(entity);
        }
示例#12
0
        public void CreatePunch(Vector3 pos, Vector3 dir, bool player)
        {
            GameEntity entity = new GameEntity("punch");

            Entity data = new Box(pos, .5f, .5f, .5f, 300);
            data.CollisionInformation.CollisionRules.Group = (Game as Game1).punchCollisionGroup;
            data.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;

            data.LinearVelocity = dir * 50;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent roomPhysics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            PunchController controller = new PunchController(mainGame, entity, player);
            entity.AddComponent(typeof(PunchController), controller);
            genComponentManager.AddComponent(controller);
        }
示例#13
0
        public void CreatePlayer()
        {
            GameEntity entity = new GameEntity("player");

            Entity box = new Box(playerSpawn, 2f, 4, 2f, 8);
            box.CollisionInformation.CollisionRules.Group = (Game as Game1).guyCollisionGroup;
            box.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;
            box.LocalInertiaTensorInverse = new Matrix3X3();
            entity.AddSharedData(typeof(Entity), box);
            camera.AssignEntity(box);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            Model playerModel = GetAnimatedModel("Models\\Player\\k_idle1");
            AnimationPlayer anims = new AnimationPlayer(playerModel.Tag as SkinningData);
            entity.AddSharedData(typeof(AnimationPlayer), anims);

            AnimatedModelComponent graphics = new AnimatedModelComponent(mainGame, entity, playerModel, 1, Vector3.Down * 2);
            entity.AddComponent(typeof(AnimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            PlayerController controller = new PlayerController(mainGame, entity);
            entity.AddComponent(typeof(PlayerController), controller);
            genComponentManager.AddComponent(controller);

            player = entity;
        }
示例#14
0
        public void CreateMailbox2(Vector3 pos)
        {
            GameEntity entity = new GameEntity("prop");

            Entity data = new Box(pos, 2, 3.75f, 2, 200);
            data.CollisionInformation.LocalPosition += Vector3.Down * 1;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent roomPhysics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\mailbox2"), new Vector3(1), Vector3.Down * 2, 0, 0, 0);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            MailboxController controller = new MailboxController(mainGame, entity);
            entity.AddComponent(typeof(MailboxController), controller);
            genComponentManager.AddComponent(controller);

            lightPoles.Add(entity);
        }
示例#15
0
        public void CreateLightPole(Vector3 pos)
        {
            GameEntity entity = new GameEntity("prop");

            Entity data = new Box(pos, 4, 18, 4, 800);
            data.CollisionInformation.LocalPosition += Vector3.Down * 4;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent roomPhysics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\lamp"), new Vector3(4), Vector3.Down * 16.5f, 0, 0, 0);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            LightPoleController controller = new LightPoleController(mainGame, entity);
            entity.AddComponent(typeof(LightPoleController), controller);
            genComponentManager.AddComponent(controller);

            camera.AddLightPoleEntity(data);

            lightPoles.Add(entity);
        }
示例#16
0
        public void CreateLevel()
        {
            Vector3    levelScale = new Vector3(5);
            GameEntity entity     = new GameEntity("environment");

            Entity locationHolder = new Box(Vector3.Zero, 1, 1, 1);

            entity.AddSharedData(typeof(Entity), locationHolder);

            Model roomModel = GetUnanimatedModel("Models\\welch");

            Vector3[] vertices;
            int[]     indices;
            TriangleMesh.GetVerticesAndIndicesFromModel(roomModel, out vertices, out indices);
            StaticMesh roomMesh = new StaticMesh(vertices, indices, new AffineTransform(levelScale, Quaternion.Identity, Vector3.Zero));

            entity.AddSharedData(typeof(StaticMesh), roomMesh);

            StaticMeshComponent roomPhysics = new StaticMeshComponent(mainGame, entity);

            entity.AddComponent(typeof(StaticMeshComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, roomModel, levelScale, Vector3.Zero, 0, 0, 0);

            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            level = entity;

            Matrix       transform = Matrix.CreateScale(levelScale) * Matrix.CreateRotationY(MathHelper.PiOver2);
            LevelTagData tag       = roomModel.Tag as LevelTagData;

            if (tag != null)
            {
                List <Vector3> lightPoles = tag.lightPoleLocations;
                foreach (Vector3 vec in lightPoles)
                {
                    CreateLightPole(Vector3.Transform(vec, transform) + Vector3.Up * 15);
                }

                List <Vector3> cars = tag.cars;
                foreach (Vector3 vec in cars)
                {
                    CreateCar(Vector3.Transform(vec, transform) + Vector3.Up * 15);
                }

                List <Vector3> boxes1 = tag.mailbox1;
                foreach (Vector3 vec in boxes1)
                {
                    CreateMailbox1(Vector3.Transform(vec, transform) + Vector3.Up * 5);
                }

                List <Vector3> boxes2 = tag.mailbox2;
                foreach (Vector3 vec in boxes2)
                {
                    CreateMailbox2(Vector3.Transform(vec, transform) + Vector3.Up * 5);
                }

                List <Vector3> beer = tag.beer;
                foreach (Vector3 vec in beer)
                {
                    CreateBeer(Vector3.Transform(vec, transform) + Vector3.Up * 5);
                }

                CreateBeer(new Vector3(10000, 10000, 10000));
            }

            CreateSkybox();
        }
示例#17
0
        public void CreateCar(Vector3 pos)
        {
            GameEntity entity = new GameEntity("prop");

            Entity data = new Box(pos, 8, 13, 11, 500);
            data.CollisionInformation.LocalPosition += Vector3.Down * 8;
            entity.AddSharedData(typeof(Entity), data);

            PhysicsComponent physics = new PhysicsComponent(mainGame, entity);
            entity.AddComponent(typeof(PhysicsComponent), physics);
            genComponentManager.AddComponent(physics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, GetUnanimatedModel("Models\\jeep"), new Vector3(2, 4, 2), Vector3.Down * 16.5f, 0, 0, 0);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            CarController controller = new CarController(mainGame, entity);
            entity.AddComponent(typeof(CarController), controller);
            genComponentManager.AddComponent(controller);

            cars.Add(entity);
        }
示例#18
0
        public void CreateLevel()
        {
            Vector3 levelScale = new Vector3(5);
            GameEntity entity = new GameEntity("environment");

            Entity locationHolder = new Box(Vector3.Zero, 1, 1, 1);
            entity.AddSharedData(typeof(Entity), locationHolder);

            Model roomModel = GetUnanimatedModel("Models\\welch");
            Vector3[] vertices;
            int[] indices;
            TriangleMesh.GetVerticesAndIndicesFromModel(roomModel, out vertices, out indices);
            StaticMesh roomMesh = new StaticMesh(vertices, indices, new AffineTransform(levelScale, Quaternion.Identity, Vector3.Zero));
            entity.AddSharedData(typeof(StaticMesh), roomMesh);

            StaticMeshComponent roomPhysics = new StaticMeshComponent(mainGame, entity);
            entity.AddComponent(typeof(StaticMeshComponent), roomPhysics);
            genComponentManager.AddComponent(roomPhysics);

            UnanimatedModelComponent graphics = new UnanimatedModelComponent(mainGame, entity, roomModel, levelScale, Vector3.Zero, 0, 0, 0);
            entity.AddComponent(typeof(UnanimatedModelComponent), graphics);
            modelManager.AddComponent(graphics);

            level = entity;

            Matrix transform = Matrix.CreateScale(levelScale) * Matrix.CreateRotationY(MathHelper.PiOver2);
            LevelTagData tag = roomModel.Tag as LevelTagData;
            if (tag != null)
            {
                List<Vector3> lightPoles = tag.lightPoleLocations;
                foreach (Vector3 vec in lightPoles)
                {
                    CreateLightPole(Vector3.Transform(vec, transform) + Vector3.Up * 15);
                }

                List<Vector3> cars = tag.cars;
                foreach (Vector3 vec in cars)
                {
                    CreateCar(Vector3.Transform(vec, transform) + Vector3.Up * 15);
                }

                List<Vector3> boxes1 = tag.mailbox1;
                foreach (Vector3 vec in boxes1)
                {
                    CreateMailbox1(Vector3.Transform(vec, transform) + Vector3.Up * 5);
                }

                List<Vector3> boxes2 = tag.mailbox2;
                foreach (Vector3 vec in boxes2)
                {
                    CreateMailbox2(Vector3.Transform(vec, transform) + Vector3.Up * 5);
                }

                List<Vector3> beer = tag.beer;
                foreach (Vector3 vec in beer)
                {
                    CreateBeer(Vector3.Transform(vec, transform) + Vector3.Up * 5);
                }

                CreateBeer(new Vector3(10000, 10000, 10000));
            }

            CreateSkybox();
        }