public PlayerEnabledButtonEntity(World world, Vector2 location, PaddleEntity player, Texture2D trueSprite, Texture2D falseSprite) : base(world, location, falseSprite) { Player = player; TrueSprite = trueSprite; FalseSprite = falseSprite; }
void CreateEntities() { EdgeEntity.Create(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_EDGE), new Vector2(0, Constants.Pong.PLAYFIELD_HEIGHT / 2), new Vector2(0, -1)); // Top edge points down EdgeEntity.Create(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_EDGE), new Vector2(0, -Constants.Pong.PLAYFIELD_HEIGHT / 2), new Vector2(0, 1)); // Bottom edge points up // Field background FieldBackgroundEntity.Create(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_FIELD_BACKGROUND)); // Player 1 goal GoalEntity.Create(_engine, _player1, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_GOAL), new Vector2(-Constants.Pong.PLAYFIELD_WIDTH / 2 + Constants.Pong.GOAL_WIDTH / 2, 0)); // Player 2 goal GoalEntity.Create(_engine, _player2, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_GOAL), new Vector2(Constants.Pong.PLAYFIELD_WIDTH / 2 - Constants.Pong.GOAL_WIDTH / 2, 0)); Entity paddle1 = PaddleEntity.Create(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_PADDLE), new Vector2(-Constants.Pong.PADDLE_STARTING_X, Constants.Pong.PADDLE_STARTING_Y), new Vector2(1, 0)); // Left paddle normal points right Entity paddle2 = PaddleEntity.Create(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_PADDLE), new Vector2(Constants.Pong.PADDLE_STARTING_X, Constants.Pong.PADDLE_STARTING_Y), new Vector2(-1, 0)); // Right paddle normal points left paddle1.AddComponent(new PlayerComponent(_player1)); paddle2.AddComponent(new PlayerComponent(_player2)); if (Player1 is AIPlayer) { paddle1.AddComponent(new AIComponent(Player1 as AIPlayer)); } if (Player2 is AIPlayer) { paddle2.AddComponent(new AIComponent(Player2 as AIPlayer)); } // Lives LivesEntity.Create(_engine, Content.Load <BitmapFont>(Constants.Resources.FONT_PONG_LIVES), new Vector2(Constants.Pong.LIVES_LEFT_POSITION_X, Constants.Pong.LIVES_POSITION_Y), _player1, Constants.Pong.LIVES_COUNT); BallEntity.CreateWithoutBehavior(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_BALL), new Vector2(Constants.Pong.LIVES_ICON_LEFT_POSITION_X, Constants.Pong.LIVES_POSITION_Y), 2); LivesEntity.Create(_engine, Content.Load <BitmapFont>(Constants.Resources.FONT_PONG_LIVES), new Vector2(Constants.Pong.LIVES_RIGHT_POSITION_X, Constants.Pong.LIVES_POSITION_Y), _player2, Constants.Pong.LIVES_COUNT); BallEntity.CreateWithoutBehavior(_engine, Content.Load <Texture2D>(Constants.Resources.TEXTURE_PONG_BALL), new Vector2(Constants.Pong.LIVES_ICON_RIGHT_POSITION_X, Constants.Pong.LIVES_POSITION_Y), 2); }