Inheritance: IEffectMatrices
 public PlayerModel(Game1 game, SkinnedModel skinnedModel)
     : base(game, skinnedModel)
 {
     game.mediator.register(this, MyEvent.P_RUN, MyEvent.C_ATTACK_BULLET_BEGIN);
     animationController.Speed = 1.2f;
     activeAnimation = PlayerAnimations.Idle;
     playAnimation();
 }
Beispiel #2
0
        internal static SkinnedModel Read(ContentReader input)
        {
            SkinnedModel skinnedModel = new SkinnedModel();

            skinnedModel.model = input.ReadObject <Model>();
            skinnedModel.ReadBones(input);
            skinnedModel.ReadAnimations(input);
            return(skinnedModel);
        }
Beispiel #3
0
        internal static SkinnedModel Read(ContentReader input)
        {
            SkinnedModel skinnedModel = new SkinnedModel();

            skinnedModel.model = input.ReadObject<Model>();
            skinnedModel.ReadBones(input);
            skinnedModel.ReadAnimations(input);
            return skinnedModel;
        }
        public Monster(Game1 game, SkinnedModel skinnedModel, Unit unit)
            : base(game, unit, new MonsterModel(game, skinnedModel))
        {
            monsterModel = ((MonsterModel)cModel);
            monsterUnit = ((MonsterUnit)unit);

            foreach (ModelMesh mesh in skinnedModel.Model.Meshes)
                foreach (SkinnedEffect effect in mesh.Effects)
                    effect.EnableDefaultLighting();
        }
 /// <summary>
 /// Loads the model.
 /// </summary>
 /// <param name="factory">The factory.</param>
 /// <param name="BatchInformations">The batch informations.</param>
 /// <param name="TextureInformations">The texture informations.</param>
 protected override void LoadModel(GraphicFactory factory, out BatchInformation[][] BatchInformations, out TextureInformation[][] TextureInformations)
 {
     skinnedModel = factory.GetAnimatedModel(Name);
     ModelBuilderHelper.Extract(factory, out BatchInformations, out TextureInformations, skinnedModel.Model,_diffuseName,_bumpName,_specularName,_glowName,isInternal);
     BoundingSphere sphere = new BoundingSphere();
     foreach (var item in skinnedModel.Model.Meshes)
     {
         sphere = BoundingSphere.CreateMerged(sphere, item.BoundingSphere);
     }
     modelRadius = sphere.Radius;                     
 }
        public Player(Game1 game, SkinnedModel skinnedModel, Unit unit)
            : base(game, unit, new PlayerModel(game, skinnedModel))
        {
            foreach (ModelMesh mesh in skinnedModel.Model.Meshes)
                foreach (SkinnedEffect effect in mesh.Effects)
                    effect.EnableDefaultLighting();

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            crossHairTex = game.Content.Load<Texture2D>("crosshair");
            delayedAction = new DelayedAction(800);
            //run at first to show to the character otherwise the character dont show
            playerRun();
        }
        public MonstersManager(Game1 game)
            : base(game)
        {
            monsters = new List<Monster>();
            myGame = game;

            rnd = new Random();

            hpBillBoardSystem = new HPBillboardSystem(game.GraphicsDevice, game.Content, Constants.HP_SIZE, monsters);
            //skinnedModel = Game.Content.Load<SkinnedModel>(@"Textures\EnemyBeast");

            skinnedModel = Game.Content.Load<SkinnedModel>(@"model\EnemyBeast");
        }
        private void reinitialize2(SkinnedModel skinnedModel)
        {
            this.skinnedModel = skinnedModel;
            //setNewEffect();

            // Create an animation controller and start a clip
            animationController = new AnimationController(skinnedModel.SkeletonBones);
            animationController.Speed = 0.5f;

            animationController.TranslationInterpolation = InterpolationMode.Linear;
            animationController.OrientationInterpolation = InterpolationMode.Linear;
            animationController.ScaleInterpolation = InterpolationMode.Linear;

            //animationController.StartClip(skinnedModel.AnimationClips[animation]);
        }
        public AnimatedModel(Game1 game,SkinnedModel skinnedModel)
            : base(game,skinnedModel.Model)
        {
            this.skinnedModel = skinnedModel;
            //setNewEffect();

            // Create an animation controller and start a clip
            animationController = new AnimationController(skinnedModel.SkeletonBones);
            animationController.Speed = 0.5f;

            animationController.TranslationInterpolation = InterpolationMode.Linear;
            animationController.OrientationInterpolation = InterpolationMode.Linear;
            animationController.ScaleInterpolation = InterpolationMode.Linear;

            //animationController.StartClip(skinnedModel.AnimationClips[animation]);
        }
        private void LoadContent()
        {
            // Load the skinned model
            skinnedModel = Game1.Content.Load<SkinnedModel>(@"Models\PlayerMarine");
            finalBoneTransform = new Matrix[skinnedModel.SkeletonBones.Count];

            // Create an animation controller and start a clip
            animationController = new AnimationController(skinnedModel.SkeletonBones);
            SetAnimation("Idle");
        }
 public virtual void reinitialize(SkinnedModel skinnedModel)
 {
     base.reinitialize(skinnedModel.Model);
     reinitialize2(skinnedModel);
 }
 public AnimatedModel(MyGame game,SkinnedModel skinnedModel)
     : base(game,skinnedModel.Model)
 {
     reinitialize2(skinnedModel);
 }
 public MonsterModel(Game1 game, SkinnedModel skinnedModel)
     : base(game, skinnedModel)
 {
     animationController.StartClip(skinnedModel.AnimationClips[animations[(int)MonsterAnimations.Idle]]);
     //animationController.CrossFade(skinnedModel.AnimationClips.Values[0], TimeSpan.FromSeconds(0.05f));
 }
Beispiel #14
0
        internal static SkinnedModel Read(ContentReader input)
        {
            SkinnedModel skinnedModel = new SkinnedModel();

            skinnedModel.ReadMeshes(input);
            skinnedModel.ReadBones(input);
            skinnedModel.ReadAnimations(input);

            skinnedModel.BoneTransforms = new Matrix[skinnedModel.SkeletonBones.Count];

            skinnedModel.EmissiveColor = Vector3.Zero;
            skinnedModel.DiffuseColor = Vector3.Zero;
            skinnedModel.SpecularColor = Vector3.Zero;
            skinnedModel.AmbientLightColor = Vector3.Zero;
            skinnedModel.SpecularPower = 1;

            skinnedModel.PointLights = new List<point_light>(SkinnedModelBasicEffect.MaxSupportedLights);
            for (int i = 0; i < SkinnedModelBasicEffect.MaxSupportedLights; i++)
                skinnedModel.PointLights.Add(new point_light());

            return skinnedModel;
        }
 public override void reinitialize(SkinnedModel skinnedModel)
 {
     base.reinitialize(skinnedModel);
      animationController.StartClip(skinnedModel.AnimationClips[animations[(int)MonsterAnimations.Idle]]);
 }