Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 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;
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }