コード例 #1
0
ファイル: PlayerManager.cs プロジェクト: rpromore/detoNATION
 public Player AddPlayer(Player p)
 {
     long id = 0;
     if( players.Keys.Count > 0 )
         id = players.Keys.Last() + 1;
     return AddPlayer(id, p);
 }
コード例 #2
0
ファイル: RangeUpgrade.cs プロジェクト: rpromore/detoNATION
 public override void Pickup(Player p)
 {
     if (p.BombRange < Config.BombMaxRange) {
         p.BombRange++;
         // mark for death
         base.Pickup (p);
     }
 }
コード例 #3
0
 // constructor (each player will need their own Counter and Meter objects)
 public UserInterface(Player pl)
 {
     player = pl;
     player.MacGuffinCount = 0;
     stunCharge = 0;
     stunCountdown = 100;
     stunIsActive = false;
 }
コード例 #4
0
ファイル: PlayerManager.cs プロジェクト: rpromore/detoNATION
 public Player AddPlayer(long id, Player p)
 {
     SpawnPoint spawn = engine.BlockManager.RequestSpawnPoint();
     p.Position = new Vector2(spawn.Point.X*32, spawn.Point.Y*32);
     p.Engine = engine;
     p.ID = id;
     players.Add(id, p);
     return p;
 }
コード例 #5
0
ファイル: FireBlock.cs プロジェクト: rpromore/detoNATION
 public override void OnPass(Player p)
 {
     base.OnPass (p);
     if (p.Rectangle.Intersects (Rectangle)) {
         Vector2 offset = Vector2.Divide (new Vector2 (Width, Height), 2.5f);
         Rectangle killArea = new Rectangle(Convert.ToInt16(Rectangle.X+offset.X), Convert.ToInt16(Rectangle.Y+offset.Y), Convert.ToInt16(Rectangle.Width-offset.X), Convert.ToInt16(Rectangle.Height-offset.Y));
         if (p.Rectangle.Intersects (killArea)) {
             //p.Kill ();
             bomb.Player.Killed(p);
         }
     }
 }
コード例 #6
0
ファイル: Game1.cs プロジェクト: secade/monogame-sample
        protected override void Initialize()
        {
            base.Initialize ();
            WindowWidth = GraphicsDevice.DisplayMode.Width;
            WindowHeight = GraphicsDevice.DisplayMode.Height;

            graphics.PreferredBackBufferWidth = WindowWidth;
            graphics.PreferredBackBufferHeight = WindowHeight;
            graphics.ApplyChanges();

            Player = new Player ((WindowWidth - 32.0f) / 2.0f, (WindowHeight - 32.0f) / 2.0f, this, squid);
            Enemy = new Enemy (WindowWidth / 4.0f, WindowHeight / 4.0f, 4, EnemyTexture, this);
        }
コード例 #7
0
ファイル: Player.cs プロジェクト: rpromore/detoNATION
 public void Killed(Player p)
 {
     if (p == this)
         --score;
     else
         ++score;
 }
コード例 #8
0
ファイル: SpeedUpgrade.cs プロジェクト: rpromore/detoNATION
 public override void Pickup(Player p)
 {
     Console.WriteLine ("More speed!");
     p.Acceleration = new Vector2(p.Acceleration.X+.1f, p.Acceleration.Y+.1f);
     base.Pickup (p);
 }
コード例 #9
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            screenManager.AddScreen(new MainMenuScreen("Menu"), PlayerIndex.One);
            screenManager.Initialize();
            otherScreens = screenManager.GetScreens();

            startPlace = new Rectangle(400, 300, 28, 62);

            player1 = new Player(1, Color.Red);
            user1 = new UserInterface(player1);
            char1 = new Character(player1);
            char1.Place = new Rectangle(400, 300, 28, 62);

            player2 = new Player(2, Color.Blue);
            user2 = new UserInterface(player2);
            char2 = new Character(player2);
            char2.Place = new Rectangle(475, 300, 28, 62);

            player3 = new Player(3, Color.Green);
            user3 = new UserInterface(player3);
            char3 = new Character(player3);
            char3.Place = new Rectangle(550, 300, 28, 62);

            player4 = new Player(4, Color.Yellow);
            user4 = new UserInterface(player4);
            char4 = new Character(player4);
            char4.Place = new Rectangle(625, 300, 28, 62);

            characters.Add(char1);
            characters.Add(char2);
            characters.Add(char3);
            characters.Add(char4);

            // read the map
            ReadMap("map1.txt");
            base.Initialize();
        }
コード例 #10
0
ファイル: Block.cs プロジェクト: rpromore/detoNATION
 public virtual void OnPass(Player p)
 {
 }
コード例 #11
0
        int startY; // holds current Y position

        #endregion Fields

        #region Constructors

        public Character(Player pl)
        {
            player = pl;
            startY = place.Y;
            jumpSpeed = 0;
        }
コード例 #12
0
ファイル: UpgradeBlock.cs プロジェクト: rpromore/detoNATION
 public virtual void Pickup(Player p)
 {
     Kill ();
 }
コード例 #13
0
ファイル: UpgradeBlock.cs プロジェクト: rpromore/detoNATION
 public override void OnPass(Player p)
 {
     base.OnPass (p);
     Pickup (p);
 }
コード例 #14
0
ファイル: TestGame.cs プロジェクト: shellingford/MemoryPlus
        private void DrawPlayerName(SpriteBatch spriteBatch, Player player, int x, int nameOffset, int pointsOffset, SpriteFont font)
        {
            if(player.CurrentMove)
            {
                var playerNameSize = _smallMenuFont.MeasureString(player.Name);
                var playerPointsSize = _smallMenuFont.MeasureString(player.Points + "");

                var width = (int)(playerNameSize.X > playerPointsSize.X ? playerNameSize.X : playerPointsSize.X) + 10;
                var height = (int)(playerNameSize.Y + playerPointsSize.Y);

                var currentPlayerBox = CreateBox(width, height, x - 5, nameOffset - 5);

                var fillText = new Texture2D(GraphicsDevice, 1, 1);
                fillText.SetData(new[] { _gameBackgroundColor });
                DrawBorder(spriteBatch, currentPlayerBox, Color.MediumVioletRed, 2);
            }

            spriteBatch.DrawString(font, player.Name, new Vector2(x, nameOffset), player.Color);
            spriteBatch.DrawString(font, player.Points + "", new Vector2(x, pointsOffset), player.Color);
        }
コード例 #15
0
ファイル: GameScene.cs プロジェクト: Rafka86/TestGame
 public GameScene(Game game)
     : base(game)
 {
     player = new Player(game);
     enemy = new Enemy(game);
 }