Пример #1
0
 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);
 }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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;
        }
Пример #5
0
 public PlayerController(Game1 game, GameEntity entity)
     : base(game, entity)
 {
     physicalData = entity.GetSharedData(typeof(Entity)) as Entity;
     anims = entity.GetSharedData(typeof(AnimationPlayer)) as AnimationPlayer;
 }