コード例 #1
0
ファイル: BeerController.cs プロジェクト: jdcook/Veishea
 public BeerController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     physicalData = entity.GetSharedData(typeof(Entity)) as Entity;
     physicalData.IsAffectedByGravity = false;
     physicalData.CollisionInformation.Events.DetectingInitialCollision += HandleCollision;
 }
コード例 #2
0
ファイル: RioterController.cs プロジェクト: jdcook/Veishea
 public RioterController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     physicalData = entity.GetSharedData(typeof(Entity)) as Entity;
     anims = entity.GetSharedData(typeof(AnimationPlayer)) as AnimationPlayer;
     playerData = game.GetPlayerEntity();
     runSpeed = game.rand.Next(15, 28);
 }
コード例 #3
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
 public void AttractMinions(GameEntity ent)
 {
     foreach (GameEntity r in recruits)
     {
         RioterController c = r.GetComponent(typeof(RioterController)) as RioterController;
         c.AttackObject(ent);
     }
 }
コード例 #4
0
        public AnimatedModelComponent(Game1 game, GameEntity entity, Model model, float drawScale, Vector3 drawOffset)
            : base(game, entity)
        {
            this.model = model;
            this.localOffset = drawOffset;
            this.syncedModels = entity.GetSharedData(typeof(Dictionary<string, Model>)) as Dictionary<string, Model>;
            this.animationPlayer = entity.GetSharedData(typeof(AnimationPlayer)) as AnimationPlayer;

            animationPlayer.StartClip(animationPlayer.skinningDataValue.AnimationClips.Keys.First(), MixType.None);

            modelParams = new SharedGraphicsParams();
            modelParams.size = new Vector3(drawScale);
            entity.AddSharedData(typeof(SharedGraphicsParams), modelParams);
        }
コード例 #5
0
        /// <summary>
        /// constructs a new model component for rendering models without animations
        /// </summary>
        public UnanimatedModelComponent(Game1 game, GameEntity entity, Model model, Vector3 drawScale, Vector3 localOffset, float yaw, float pitch, float roll)
            : base(game, entity)
        {
            this.model = model;
            this.localOffset = localOffset;

            modelParams = new SharedGraphicsParams();
            modelParams.size = drawScale;
            entity.AddSharedData(typeof(SharedGraphicsParams), modelParams);

            this.yaw = yaw;
            this.pitch = pitch;
            this.roll = roll;

            Matrix3X3 bepurot = physicalData.OrientationMatrix;
            rotation = new Matrix(bepurot.M11, bepurot.M12, bepurot.M13, 0, bepurot.M21, bepurot.M22, bepurot.M23, 0, bepurot.M31, bepurot.M32, bepurot.M33, 0, 0, 0, 0, 1);
        }
コード例 #6
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #7
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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;
        }
コード例 #8
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #9
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #10
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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();
        }
コード例 #11
0
ファイル: CarController.cs プロジェクト: jdcook/Veishea
 public CarController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     stupid = 35;
 }
コード例 #12
0
ファイル: Game1.cs プロジェクト: jdcook/Veishea
 public void PunchObject(GameEntity obj)
 {
     entities.AttractMinions(obj);
     AddStupid(2);
 }
コード例 #13
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #14
0
ファイル: Component.cs プロジェクト: jdcook/Veishea
 public Component(Game1 game, GameEntity entity)
 {
     this.Game = game;
     this.Entity = entity;
     Remove = false;
 }
コード例 #15
0
ファイル: MailboxController.cs プロジェクト: jdcook/Veishea
 public MailboxController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     stupid = 10;
 }
コード例 #16
0
ファイル: RioterController.cs プロジェクト: jdcook/Veishea
 public void AttackObject(GameEntity ob)
 {
     attackingObj = ob.GetSharedData(typeof(Entity)) as Entity;
 }
コード例 #17
0
ファイル: DesctructibleProp.cs プロジェクト: jdcook/Veishea
 public DestructibleProp(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     physicalData = entity.GetSharedData(typeof(Entity)) as Entity;
     physicalData.CollisionInformation.Events.DetectingInitialCollision += HandleCollision;
 }
コード例 #18
0
ファイル: PhysicsComponent.cs プロジェクト: jdcook/Veishea
 public PhysicsComponent(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     this.collidable = entity.GetSharedData(typeof(Entity)) as Entity;
 }
コード例 #19
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #20
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #21
0
ファイル: DrawableComponent3D.cs プロジェクト: jdcook/Veishea
 public DrawableComponent3D(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     this.physicalData = entity.GetSharedData(typeof(Entity)) as Entity;
 }
コード例 #22
0
ファイル: StaticMeshComponent.cs プロジェクト: jdcook/Veishea
 public StaticMeshComponent(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     this.collidable = Entity.GetSharedData(typeof(StaticMesh)) as StaticMesh;
 }
コード例 #23
0
ファイル: LightPole.cs プロジェクト: jdcook/Veishea
 public LightPoleController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     stupid = 25;
 }
コード例 #24
0
ファイル: EntityManager.cs プロジェクト: jdcook/Veishea
        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);
        }
コード例 #25
0
ファイル: PlayerController.cs プロジェクト: jdcook/Veishea
 public PlayerController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     physicalData = entity.GetSharedData(typeof(Entity)) as Entity;
     anims = entity.GetSharedData(typeof(AnimationPlayer)) as AnimationPlayer;
 }