Esempio n. 1
0
        AnimatedPlayer getNewAnimatedPlayer()
        {
            AnimatedPlayer newPlayer = new AnimatedPlayer(PhysicsUpdateInterval);

            #region walking animation
            newPlayer.AnimationWalkFront        = new Animation(animationPlayerMoveFront.TimeForFrame);
            newPlayer.AnimationWalkFront.Frames = animationPlayerMoveFront.Frames;


            newPlayer.AnimationWalkBack        = new Animation(animationPlayerMoveBack.TimeForFrame);
            newPlayer.AnimationWalkBack.Frames = animationPlayerMoveBack.Frames;

            newPlayer.AnimationWalkLeft        = new Animation(animationPlayerMoveLeft.TimeForFrame);
            newPlayer.AnimationWalkLeft.Frames = animationPlayerMoveLeft.Frames;

            newPlayer.AnimationWalkRight        = new Animation(animationPlayerMoveRight.TimeForFrame);
            newPlayer.AnimationWalkRight.Frames = animationPlayerMoveRight.Frames;

            #endregion
            #region animation none
            newPlayer.AnimationNoneFront        = new Animation(animationPlayerNoneFront.TimeForFrame);
            newPlayer.AnimationNoneFront.Frames = animationPlayerNoneFront.Frames;

            newPlayer.AnimationNoneBack        = new Animation(animationPlayerNoneBack.TimeForFrame);
            newPlayer.AnimationNoneBack.Frames = animationPlayerNoneBack.Frames;

            newPlayer.AnimationNoneLeft        = new Animation(animationPlayerNoneLeft.TimeForFrame);
            newPlayer.AnimationNoneLeft.Frames = animationPlayerNoneLeft.Frames;

            newPlayer.AnimationNoneRight        = new Animation(animationPlayerNoneRight.TimeForFrame);
            newPlayer.AnimationNoneRight.Frames = animationPlayerNoneRight.Frames;
            #endregion
            #region animation shoot
            newPlayer.AnimationAttackFront        = new Animation(animationShootFront.TimeForFrame);
            newPlayer.AnimationAttackFront.Frames = animationShootFront.Frames;

            newPlayer.AnimationAttackBack        = new Animation(animationShootBack.TimeForFrame);
            newPlayer.AnimationAttackBack.Frames = animationShootBack.Frames;

            newPlayer.AnimationAttackLeft        = new Animation(animationShootLeft.TimeForFrame);
            newPlayer.AnimationAttackLeft.Frames = animationShootLeft.Frames;

            newPlayer.AnimationAttackRight        = new Animation(animationShootRight.TimeForFrame);
            newPlayer.AnimationAttackRight.Frames = animationShootRight.Frames;
            #endregion
            newPlayer.AnimationDie        = new Animation(animationDie.TimeForFrame);
            newPlayer.AnimationDie.Frames = animationDie.Frames;

            return(newPlayer);
        }
Esempio n. 2
0
 void updateAnimatedPlayers(int time)
 {
     foreach (var playerID in gameLogic.Players.Keys.ToArray())
     {
         if (!animatedPlayers.ContainsKey(playerID) && playerID != gameLogic.ThisPlayerID)
         {
             AnimatedPlayer newPlayer = getNewAnimatedPlayer();
             // newPlayer.AnimationDie =
             var logicPlayer = gameLogic.Players[playerID];
             newPlayer.UpdatePlayer(logicPlayer, Environment.TickCount);
             newPlayer.PlayerID = playerID;
             animatedPlayers.Add(playerID, newPlayer);
         }
     }
     foreach (AnimatedPlayer animatedPlayer in animatedPlayers.Values)
     {
         animatedPlayer.UpdateAnimation(gameLogic.GetThisPlayer(), time);
     }
 }