Пример #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Пример #2
0
 public MapBuilder(Game1 useForLoadingContent, int screenWidth, int screenHeight, GraphicsDeviceManager graphics, int tileSize, Player thisPlayer, SpriteBatch spriteBatch, Dictionary<long, Player> players)
 {
     this.useForLoadingContent = useForLoadingContent;
     this.screenWidth = screenWidth;
     this.screenHeight = screenHeight;
     this.graphics = graphics;
     this.tileSize = tileSize;
     this.thisPlayer = thisPlayer;
     this.spriteBatch = spriteBatch;
     this.players = players;
 }
Пример #3
0
        public void GetPosition(Dictionary<Int64, Player> players, List<Weapon> weaponDefinitions, Game1 forLoadingContent, SpriteBatch spriteBatch)
        {
            long who = msg.ReadInt64();
            int x = msg.ReadInt32();
            int y = msg.ReadInt32();
            int angle = msg.ReadInt32();
            bool isShooting = msg.ReadBoolean();
            bool isHuman = msg.ReadBoolean();
            if (players.ContainsKey(who))
            {
                players[who].Position = new Vector2(x, y);
                players[who].Direction = new Vector2(-(float)Math.Sin(((float)angle) / 1000), (float)Math.Cos(((float)angle) / 1000));
            }
            else
            {
                players[who] = new Player { PlayerType = isHuman ? Player.PlayerTypes.human : Player.PlayerTypes.alien,
                                            AnimatedTexture = new AnimatedTexture(isHuman ? forLoadingContent.Content.Load<Texture2D>("PlayerSprites/dudespritesheet") : forLoadingContent.Content.Load<Texture2D>("PlayerSprites/alienspritesheet"), 4, 4, true, 20, spriteBatch, 50, 50, new Vector2(25, 25), null),
                                            Id = who
                };
                Weapon weaponDefinition = weaponDefinitions.SingleOrDefault(w => w.Name == "gun");

                players[who].AddWeapon(weaponDefinition.Clone());
            }
        }