コード例 #1
0
        /// <summary>
        /// 重置Avatar资源
        /// </summary>
        public void ResetAvatarResource(NActor ownerActor)
        {
            targetActorRef = new WeakReference(ownerActor);

            NSkeletalMeshComponent skeletalMeshMeshCmp = (NSkeletalMeshComponent)ownerActor.CreateComponent("LPC_Skeletal_Mesh", "nskeletal_mesh_component");

            skeletalMeshComponentRef = new WeakReference(skeletalMeshMeshCmp);

            try
            {
                // 初始化资源
                skeletalMeshMeshCmp.ResetResource(new NResourceLoc("content", @"/characters/XiaShi/body.skm"), true);

                // 初始化动画
                AnimPlayer = skeletalMeshMeshCmp.ResetSkeletalAnimPlayer();
                AnimPlayer.Init(NResourceManager.Instance.LoadSkeletalAnimSet(
                                    new NResourceLoc("content", @"/characters/XiaShi/base_act.animset"),
                                    EResourceIOMode.Auto,
                                    EResourceIOPriority.Normal
                                    ), true);
            }
            catch (System.Exception e)
            {
                NLogger.Instance.WriteString(LogType.Exception, "Load  Skeletal Mesh faild!" + e.ToString());
                Program.ShowException(e, "Load  Skeletal Mesh faild!");
            }
        }
コード例 #2
0
 public void PlayAnim(bool loop, float rate, float startTime)
 {
     if (AnimPlayer != null)
     {
         AnimPlayer.PlayAnim(loop, rate, startTime);
     }
 }
コード例 #3
0
 private void Awake()
 {
     if (this.character == null)
     {
         this.character = base.GetComponent <Units>();
     }
     if (this.animator == null)
     {
         this.animator = base.GetComponentInChildren <Animator>();
     }
     if (this.animator != null)
     {
         this.animator.logWarnings = false;
     }
     this.animplayer = base.GetComponent <AnimPlayer>();
     if (GlobalSettings.meshanim)
     {
         if (this.animplayer != null)
         {
             this.usingmeshanim = true;
         }
         else
         {
             this.usingmeshanim = false;
         }
     }
     else
     {
         this.usingmeshanim = false;
     }
     this.roc = this.character.GetComponentInChildren <RecieverObjCtrl>();
 }
コード例 #4
0
        internal void SendPacket(int toWho, int fromWho)
        {
            ModPacket  packet     = GetPacket(fromWho);
            AnimPlayer fromPlayer = Main.player[fromWho].GetModPlayer <AnimPlayer>();

            var modsToUpdate = (from pair in fromPlayer.characters.dict
                                where pair.Value.abilityManager?.netUpdate ?? false
                                select pair).ToList();

            packet.WriteLowestCast(modsToUpdate.Count, ModNet.NetModCount);

            foreach ((Mod mod, AnimCharacter character) in modsToUpdate)
            {
                packet.Write(mod.Name);
                var abilities         = character.abilityManager?.abilityArray;
                var abilitiesToUpdate = (from a in abilities
                                         where a.netUpdate
                                         select a).ToList();

                if (abilities is null)
                {
                    packet.Write((byte)0);
                    continue;
                }

                packet.WriteLowestCast(abilitiesToUpdate.Count, abilities.Length);
                foreach (Ability ability in abilitiesToUpdate)
                {
                    packet.WriteLowestCast(ability.Id, abilities.Length);
                    ability.PreWritePacket(packet);
                }
            }

            packet.Send(toWho, fromWho);
        }
コード例 #5
0
        // AnimLib Ability Packet structure:
        //
        // 1 or 2 bytes Mod_Count
        // foreach Mod_Count:
        //   X bytes Mod_Name
        //   1 or 2 bytes Ability_Count
        //   foreach Ability_Count:
        //     1 or 2 bytes Ability_ID
        //     [ Remaining handled by Ability[AbilityID].Read()/.Write() ]
        internal override void HandlePacket(BinaryReader reader, int fromWho)
        {
            AnimPlayer fromPlayer = Main.player[fromWho].GetModPlayer <AnimPlayer>();
            int        modCount   = reader.ReadLowestCast(ModNet.NetModCount);

            for (int i = 0; i < modCount; i++)
            {
                Mod            mod     = ModLoader.GetMod(reader.ReadString());
                AbilityManager manager = fromPlayer.characters[mod].abilityManager;
                if (manager is null)
                {
                    continue;
                }
                int abilityCount = reader.ReadLowestCast(manager.abilityArray.Length);
                for (int j = 0; j < abilityCount; j++)
                {
                    int     abilityId = reader.ReadLowestCast(manager.abilityArray.Length);
                    Ability ability   = manager[abilityId];
                    ability.PreReadPacket(reader);
                }
            }

            if (Main.netMode == NetmodeID.Server)
            {
                SendPacket(-1, fromWho);
            }
        }
コード例 #6
0
 public void SetAnim(string AnimName)
 {
     if (AnimPlayer != null)
     {
         AnimPlayer.SetAnim(AnimName);
     }
 }
コード例 #7
0
 public void ReloopAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString() + OrientationStrings[(int)CurrentOrientation]);
     if (AnimPlayer.IsDone())
     {
         AnimPlayer.Reset();
     }
 }
コード例 #8
0
ファイル: MachineGun.cs プロジェクト: Gerjo/Gravwar
 public MachineGunBullet(AnimPlayer ownerPlayer)
     : base(ownerPlayer)
 {
     // Load the texture:
     bulletTexture = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/bulletMachineGun");
     bulletSpeed   = 30;
     damageScore   = 20;
 }
コード例 #9
0
 public override void OnUnDoExecute()
 {
     base.OnUnDoExecute();
     coroutineCtrl.Cansalce(DelyPlay);
     animPlayer.UnDoChanges(this);
     animPlayer.RemovePlayer(this);
     animPlayer = null;
 }
コード例 #10
0
ファイル: Pistol.cs プロジェクト: Gerjo/Gravwar
 public PistolBullet(AnimPlayer ownerPlayer)
     : base(ownerPlayer)
 {
     // Load the textures:
     bulletTexture = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/bulletRotate");
     bulletSpeed   = 45;
     damageScore   = 20;
 }
コード例 #11
0
ファイル: CharacterSprite.cs プロジェクト: sodomon2/dwarfcorp
 public void ReloopAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString(), true);
     if (AnimPlayer.IsDone())
     {
         AnimPlayer.Reset();
     }
 }
コード例 #12
0
 public static bool drawAnim(Graphics g, ref AnimPlayer p, int x, int y)
 {
     if (p.getAnimID() < 0)
     {
         return(false);
     }
     AnimationManager.drawAnimFrame(g, p.getAnimID(), p.getCurrAnimFrame(), x, y);
     return(true);
 }
コード例 #13
0
 protected override void Awake()
 {
     base.Awake();
     if (animPlayer == null)
     {
         animPlayer = GetComponentInChildren <AnimPlayer>(true);
     }
     defaultAnimPlayer = animPlayer;
 }
コード例 #14
0
ファイル: RocketLauncher.cs プロジェクト: Gerjo/Gravwar
 public RocketBullet(AnimPlayer ownerPlayer)
     : base(ownerPlayer)
 {
     // Load the textures:
     bulletTexture = Game1.INSTANCE.Content.Load<Texture2D>("Images/Weapons/rocket");
     bulletSpeed   = 25;
     damageScore   = 70;
     isFlameable   = true;
 }
コード例 #15
0
ファイル: BouncyGun.cs プロジェクト: Gerjo/Gravwar
        public BouncyGunBullet(AnimPlayer ownerPlayer)
            : base(ownerPlayer)
        {
            // Load the textures:
            bulletTexture = Game1.INSTANCE.Content.Load<Texture2D>("Images/Weapons/grenadeRotate");

            bulletSpeed   = 20;
            damageScore   = 80;
            isFlameable = true;
            size.X = 25;
            size.Y = 25;
        }
コード例 #16
0
 public override void SetCurrentAnimation(string name, bool Play = false)
 {
     if (currentMode != name || Play)
     {
         currentMode = name;
         var s = currentMode + OrientationStrings[(int)CurrentOrientation];
         if (Animations.ContainsKey(s))
         {
             AnimPlayer.ChangeAnimation(Animations[s], AnimationPlayer.ChangeAnimationOptions.NoStateChange);
         }
     }
 }
コード例 #17
0
        override public void Render(DwarfTime gameTime, ChunkManager chunks, Camera camera, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice, Shader effect, bool renderingForWater)
        {
            base.Render(gameTime, chunks, camera, spriteBatch, graphicsDevice, effect, renderingForWater);
            CalculateCurrentOrientation(camera);


            var s = currentMode + OrientationStrings[(int)CurrentOrientation];

            if (Animations.ContainsKey(s))
            {
                AnimPlayer.ChangeAnimation(Animations[s], AnimationPlayer.ChangeAnimationOptions.Play);
                AnimPlayer.Update(gameTime, true);
            }
        }
コード例 #18
0
        public override void Update(DwarfTime gameTime, ChunkManager chunks, Camera camera)
        {
            CalculateCurrentOrientation(camera);


            var s = currentMode + OrientationStrings[(int)CurrentOrientation];

            if (Animations.ContainsKey(s))
            {
                AnimPlayer.ChangeAnimation(Animations[s], AnimationPlayer.ChangeAnimationOptions.Play | AnimationPlayer.ChangeAnimationOptions.Loop);
            }

            base.Update(gameTime, chunks, camera);
        }
コード例 #19
0
ファイル: HeatSeeking.cs プロジェクト: Gerjo/Gravwar
        private int targetPlayerIndex = -1; // Who are we "attacking"

        #endregion Fields

        #region Constructors

        public HeatSeekingBullet(AnimPlayer ownerPlayer)
            : base(ownerPlayer)
        {
            // Load the texture:
            bulletTexture = Game1.INSTANCE.Content.Load<Texture2D>("Images/AnimPlayer/bulletRotate");
            bulletSpeed = 2;
            damageScore = 10;

            // Find the player closest by:
            targetPlayerIndex = getPlayerIndexClosestToBullet();

            // Do something here... ?
            if (targetPlayerIndex == -1) { }
        }
コード例 #20
0
    public static bool drawAnim(Graphics g, int animID, int x, int y)
    {
        AnimationManagerData animManData = AppEngine.getCanvas().getAnimManData();

        for (int index = 0; index < 48; ++index)
        {
            AnimPlayer animPlayer = animManData.m_animPlayerPool[index];
            if (animPlayer.getAnimID() == animID)
            {
                AnimationManager.drawAnimFrame(g, animID, animPlayer.getCurrAnimFrame(), x, y);
                return(true);
            }
        }
        return(false);
    }
コード例 #21
0
        public override void OnUnDoExecute()
        {
            base.OnUnDoExecute();
            if (delyPlay != null)
            {
                StopCoroutine(delyPlay);
            }

            if (animPlayer != null)
            {
                animPlayer.StepUnDo();
                animPlayer.RemovePlayer(this);
                animPlayer = defaultAnimPlayer;
            }
        }
コード例 #22
0
 public static MeshClip1 getMeshClips(AnimPlayer ctrl, string name)
 {
     if (ModelAnimation.s_mapMeshCenter.ContainsKey(name))
     {
         Dictionary <string, List <Mesh> > dictionary = ModelAnimation.s_mapMeshCenter[name];
         MeshClip1 meshClip = new MeshClip1();
         string    text     = ctrl.meshanim[0].name;
         text = text.Substring(0, text.Length - 1);
         if (ctrl.meshanim != null && dictionary.ContainsKey(text))
         {
             meshClip.m_MeshFrames = dictionary[text];
             return(meshClip);
         }
     }
     return(null);
 }
コード例 #23
0
ファイル: AbstractBullet.cs プロジェクト: Gerjo/Gravwar
        public AbstractBullet(AnimPlayer ownerPlayer)
        {
            this.ownerPlayer      = ownerPlayer;

            // Link the normalized direction we are aiming at to the bullet.
            normalizedDirection = ownerPlayer.inputDevice.getAimDirectionNormalized();

            // Set base the position: "steun vector" for the bullet:
            this.position = ownerPlayer.getBulletSpawnLocation(); // ownerPlayer.getShoulderLocation();

            // Because it should appear as if the bullet comes from the gun barrel, we increment the position.
            // Increase this digit to spawn the bullet farther away from the barrel.
            this.position += normalizedDirection * 45;

            for (int i = 0; i < maxFlame; i++)
                flameTexture[i] = Game1.INSTANCE.Content.Load<Texture2D>("Images/Weapons/Flame/" + (i + startFlame));
        }
コード例 #24
0
ファイル: Monster.cs プロジェクト: whztt07/mobahero_src
 protected override void OnCreate()
 {
     this.ap            = base.GetComponentInChildren <AnimPlayer>();
     this.data          = base.AddUnitComponent <MonsterDataManager>(!Singleton <PvpManager> .Instance.IsInPvp);
     this.atkController = base.AddUnitComponent <MonsterAttackController>();
     base.OnCreate();
     base.ChangeLayer("Monster");
     if (this.m_model != null)
     {
         eventPlayerSound eventPlayerSound = this.m_model.gameObject.GetComponent <eventPlayerSound>();
         if (eventPlayerSound == null)
         {
             eventPlayerSound = this.m_model.gameObject.AddComponent <eventPlayerSound>();
         }
         eventPlayerSound.units  = this;
         this.m_eventPlayerSound = eventPlayerSound;
     }
 }
コード例 #25
0
        public override void Update(GameTime gameTime)
        {
            float    tempsÉcoulé = (float)gameTime.ElapsedGameTime.TotalSeconds;
            TimeSpan accelTime   = GérerTimeScale(gameTime);

            TempsÉcouléDepuisMAJ += tempsÉcoulé;
            if (Animated)
            {
                AnimPlayer.Update(accelTime, true, Matrix.Identity);
            }
            if (TempsÉcouléDepuisMAJ > Jeu.INTERVALLE_MAJ)
            {
                UpdateWorld();
                CreateBoxList();
                TempsÉcouléDepuisMAJ = 0;
            }
            GérerClavier();
            base.Update(gameTime);
        }
コード例 #26
0
        private void FindAnimCore(bool record)
        {
            if (animPlayer == null)
            {
                var elements = elementCtrl.GetElements <AnimPlayer>(animName, true);
                if (elements != null && elements.Count > 0)
                {
                    animPlayer = elements.Find(x => x.Body != null && x.OperateAble);//[0];
                }
            }

            if (animPlayer)
            {
                if (record)
                {
                    animPlayer.RecordPlayer(this);
                }
                animPlayer.gameObject.SetActive(true);
            }
        }
コード例 #27
0
    /// <summary>
    /// 轉換狀態
    /// </summary>
    /// <param name="_state"></param>
    /// <returns></returns>
    IEnumerator Transit(string _state)
    {
        if (SubscribeStateLibrary.ContainsKey(sNextState))             //防呆!如果沒有註冊該狀態跳Log
        {
            AnimPlayer.SetBool(sCurrentState, false);                  //(Animator)把原本進這狀態的transition關上
            LeaveCurrentState(SubscribeStateLibrary[sCurrentState]);   //執行Leave
            sCurrentState = sNextState;                                //目前狀態->新的狀態
            sNextState    = null;                                      //把排隊的位置清掉
            bAllowTransit = false;                                     //新的狀態即重新計算可轉換的時機
            AnimPlayer.SetBool(sCurrentState, true);                   //(Animator)打開前往下一個狀態的transition
            TransitCurrentState(SubscribeStateLibrary[sCurrentState]); //執行Transit
            StartCoroutine(InputController());                         //從轉換開始當下已開始跑下一狀態的動作,因此剛轉換呼叫為準
        }
        else
        {
            Debug.Log("An accidental state be called !");                         //防呆!如果沒有註冊該狀態跳Log
        }
        yield return(new WaitUntil(() => AnimPlayer.IsInTransition(0) == false)); //(Animator)等,直到動作切換結束

        EnterCurrentState(SubscribeStateLibrary[sCurrentState]);                  //轉換結束後呼叫Enter該狀態改變規範
    }
コード例 #28
0
        private void FindAnimCore()
        {
            if (animPlayer == null)
            {
                var elements = elementCtrl.GetElements <AnimPlayer>(Name);
                if (elements != null && elements.Count > 0)
                {
                    animPlayer = elements.Find(x => x.Body != null && x.CanPlay());//[0];
                }
            }

            if (animPlayer)
            {
                animPlayer.gameObject.SetActive(true);

                if (playAtPostion)
                {
                    animPlayer.transform.localPosition = transform.position;
                    animPlayer.transform.localRotation = transform.rotation;
                }
            }
        }
コード例 #29
0
ファイル: CharacterSprite.cs プロジェクト: sodomon2/dwarfcorp
 public void ResetAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString());
     AnimPlayer.Reset();
 }
コード例 #30
0
ファイル: Pistol.cs プロジェクト: Gerjo/Gravwar
 // Return a new bullet instance that belongs to this type of gun.
 public override AbstractBullet getBullet(AnimPlayer ownerPlayer)
 {
     currentAmmunition--; // Remove a single bullet.
     return new PistolBullet(ownerPlayer);
 }
コード例 #31
0
        private Message Action(CommandCaller caller, IReadOnlyList <string> args)
        {
            int    idx = 0;
            string arg = string.Empty;

            bool NextArg()
            {
                if (args.Count <= idx)
                {
                    return(false);
                }
                arg = args[idx++];
                return(true);
            }

            AnimPlayer player = caller.Player.GetModPlayer <AnimPlayer>();

            if (!player.DebugEnabled)
            {
                return(Error("This command cannot be used outside of debug mode."));
            }
            if (!AnimLoader.HasMods)
            {
                return(Error($"This command cannot be used when no mods are using {nameof(AnimLib)}."));
            }
            if (!NextArg())
            {
                return(Error($"This command requires arguments. Usage: {Usage}"));
            }

            Mod targetMod = ModLoader.GetMod(arg);

            if (targetMod is null)
            {
                // We'll allow not specifying mod only if exactly one mod is using AnimLib
                AnimLoader.GetLoadedMods(out var loadedMod);
                if (loadedMod.Count > 1)
                {
                    return(Error($"Must specify mod when more than one mod is using {nameof(AnimLib)}."));
                }

                // Only one mod is loaded, command implicitly refers to that mod
                targetMod = loadedMod[0];
                idx--;
            }

            if (!NextArg())
            {
                return(Error("This command requires at least 2 arguments."));
            }
            if (!AnimLoader.LoadedMods.Contains(targetMod))
            {
                return(Error($"Mod {targetMod} does not use AnimLib."));
            }

            AbilityManager manager = player.characters[mod].abilityManager;

            if (manager is null)
            {
                return(Error($"Mod {targetMod} does not have abilities."));
            }

            Ability ability = null;

            if (int.TryParse(arg, out int id))
            {
                if (!manager.TryGet(id, out ability))
                {
                    return(Error("Specified ability ID is out of range."));
                }
                ability = manager[id];
            }
            else
            {
                foreach (Ability a in manager)
                {
                    if (string.Equals(a.GetType().Name, arg, StringComparison.OrdinalIgnoreCase))
                    {
                        ability = a;
                        break;
                    }
                }

                if (ability is null)
                {
                    return(Error($"\"{arg}\" is not a valid ability name."));
                }
            }

            ILevelable levelable = ability as ILevelable;

            if (NextArg())
            {
                if (!int.TryParse(arg, out int level))
                {
                    return(Error("Argument must be a number."));
                }
                if (level < 0)
                {
                    return(Error("Argument must be a positive number."));
                }
                if (levelable is null)
                {
                    return(new Message($"{ability} cannot be leveled."));
                }
                levelable.Level = level;
                return(level > levelable.MaxLevel
          ? SuccessWarn($"{ability.GetType().Name} level set to {levelable.Level}/{levelable.MaxLevel}. This level is above max level, and is not supported.")
          : Success($"{ability.GetType().Name} level set to {levelable.Level}/{levelable.MaxLevel}."));
            }

            return(Success(levelable is null
        ? $"{ability.GetType().Name} is currently {(ability.Unlocked ? "Unlocked" : "Locked")} "
        : $"{ability.GetType().Name} is currently {(ability.Unlocked ? "Unlocked" : "Locked")} at level {levelable.Level}/{levelable.MaxLevel}"));
        }
コード例 #32
0
        public override void Draw(GameTime gameTime)
        {
            if (Animated)
            {
                Matrix[] bones = AnimPlayer.GetSkinTransforms();

                // Compute camera matrices.
                Matrix view = ScèneJeu.CaméraJeu.Vue;

                Matrix projection = ScèneJeu.CaméraJeu.Projection;

                // Render the skinned mesh.
                foreach (ModelMesh mesh in Modèle.Meshes)
                {
                    Matrix mondeLocal = TransformationsModèle[mesh.ParentBone.Index] * GetMonde();
                    foreach (SkinnedEffect effect in mesh.Effects)
                    {
                        effect.SetBoneTransforms(bones);

                        effect.View       = view;
                        effect.Projection = projection;
                        effect.World      = mondeLocal;

                        effect.EnableDefaultLighting();
                    }

                    mesh.Draw();
                }
            }
            else
            {
                foreach (ModelMesh maille in Modèle.Meshes)
                {
                    Vector3[] oldColor   = new Vector3[maille.MeshParts.Count];
                    int       i          = 0;
                    Matrix    mondeLocal = TransformationsModèle[maille.ParentBone.Index] * GetMonde();
                    foreach (ModelMeshPart portionDeMaillage in maille.MeshParts)
                    {
                        BasicEffect effet = (BasicEffect)portionDeMaillage.Effect;
                        oldColor[i] = effet.EmissiveColor;
                        effet.EnableDefaultLighting();
                        GérerSurlignage(ref effet);
                        GérérCouleurCharm(ref effet);
                        effet.Projection = ScèneJeu.CaméraJeu.Projection;
                        effet.View       = ScèneJeu.CaméraJeu.Vue;
                        effet.World      = mondeLocal;
                        i++;
                    }
                    maille.Draw();
                    i = 0;
                    foreach (ModelMeshPart portionDeMaillage in maille.MeshParts)
                    {
                        BasicEffect effet = (BasicEffect)portionDeMaillage.Effect;
                        effet.EmissiveColor = oldColor[i];
                        i++;
                    }
                }
            }
            //Draw boxes
            if (DrawBoxes)
            {
                //Box effect
                if (lineEffect == null) // Comme ça on a qu'à le créer une seule fois (et on ne peut le créer dans le Initialize())
                {
                    lineEffect = new BasicEffect(ScèneJeu.GraphicsDevice);
                    lineEffect.LightingEnabled    = false;
                    lineEffect.TextureEnabled     = false;
                    lineEffect.VertexColorEnabled = true;
                }
                foreach (BoundingBoxBuffers bb in BoxDrawList)
                {
                    DrawBoundingBox(bb, lineEffect, ScèneJeu.GraphicsDevice, ScèneJeu.CaméraJeu.Vue, ScèneJeu.CaméraJeu.Projection);
                }
            }
        }
コード例 #33
0
 public void ResetAnimations(CharacterMode mode)
 {
     SetCurrentAnimation(mode.ToString() + OrientationStrings[(int)CurrentOrientation]);
     AnimPlayer.Reset();
 }
コード例 #34
0
ファイル: Doodad.cs プロジェクト: christophebedard/DeRPG
        public override void Draw(GameTime gameTime)
        {
            Jeu.GraphicsDevice.BlendState = NewBlendState;

            if (Animated)
            {
                Matrix[] bones = AnimPlayer.GetSkinTransforms();

                // Compute camera matrices.
                Matrix view = ScèneJeu.CaméraJeu.Vue;

                Matrix projection = ScèneJeu.CaméraJeu.Projection;

                // Render the skinned mesh.
                foreach (ModelMesh mesh in Modèle.Meshes)
                {
                    Matrix mondeLocal = TransformationsModèle[mesh.ParentBone.Index] * GetMonde();
                    foreach (SkinnedEffect effect in mesh.Effects)
                    {
                        effect.SetBoneTransforms(bones);

                        effect.View       = view;
                        effect.Projection = projection;
                        effect.World      = mondeLocal;
                        effect.Texture    = Texture; //not sure if works
                        effect.EnableDefaultLighting();

                        effect.SpecularColor = new Vector3(0.25f);
                        effect.SpecularPower = 16;
                    }

                    mesh.Draw();
                }
            }
            else
            {
                foreach (ModelMesh maille in Modèle.Meshes)
                {
                    Matrix mondeLocal = TransformationsModèle[maille.ParentBone.Index] * GetMonde();
                    foreach (ModelMeshPart portionDeMaillage in maille.MeshParts)
                    {
                        BasicEffect effet = (BasicEffect)portionDeMaillage.Effect;
                        effet.EnableDefaultLighting();
                        effet.Projection     = ScèneJeu.CaméraJeu.Projection;
                        effet.View           = ScèneJeu.CaméraJeu.Vue;
                        effet.World          = mondeLocal;
                        effet.TextureEnabled = true;
                        effet.Texture        = Texture;
                    }
                    maille.Draw();
                }

                //Draw boxes
                if (DrawBoxes)
                {
                    //Box effect
                    if (lineEffect == null) // Comme ça on a qu'à le créer une seule fois (et on ne peut le créer dans le Initialize())
                    {
                        lineEffect = new BasicEffect(ScèneJeu.GraphicsDevice);
                        lineEffect.LightingEnabled    = false;
                        lineEffect.TextureEnabled     = false;
                        lineEffect.VertexColorEnabled = true;
                    }

                    foreach (BoundingBoxBuffers bb in BoxDrawList)
                    {
                        DrawBoundingBox(bb, lineEffect, ScèneJeu.GraphicsDevice, ScèneJeu.CaméraJeu.Vue, ScèneJeu.CaméraJeu.Projection);
                    }
                }
            }

            Jeu.GraphicsDevice.BlendState = OldBlendState;
        }
コード例 #35
0
ファイル: CharacterSprite.cs プロジェクト: sodomon2/dwarfcorp
 public void PauseAnimations(CharacterMode mode)
 {
     AnimPlayer.Pause();
 }
コード例 #36
0
 public static void drawAnim(Graphics g, AnimPlayer p, int x, int y)
 {
     AnimationManager.drawAnimFrame(g, p.getAnimID(), p.getCurrAnimFrame(), x, y);
 }
コード例 #37
0
ファイル: AbstractWeapon.cs プロジェクト: Gerjo/Gravwar
 // This function MUST be implemented:
 public abstract AbstractBullet getBullet(AnimPlayer ownerPlayer);
コード例 #38
0
ファイル: CharacterSprite.cs プロジェクト: sodomon2/dwarfcorp
 public void PlayAnimations(CharacterMode mode)
 {
     AnimPlayer.Play();
 }