protected GameObject(string imagePath, Vector2 initialPosition, int speedMilisecond, int moveLenght) { _speedMilisecond = speedMilisecond; Image = new ImageFile { ImagePath = imagePath, Position = initialPosition }; Active = true; _moveLenght = moveLenght; }
private async void LoadHighScoresAsync() { try { var tmpImages = new List<ImageFile>(); var i = 1; var position = new Vector2(0, _highScores.Position.Y + (_highScores.SourceRectangle.Height * _highScores.Scale.Y) + 20); var scores = GameManager.MobileService.GetTable<ScoreItem>().Take(10).OrderByDescending(x => x.HighScore).ToListAsync(); foreach (var score in await scores) { var img = new ImageFile { Text = String.Format("{0} - {1}: {2}", i, score.PlayerName, score.HighScore) }; img.LoadContent(Content); img.Position = position; img.CenterX(GameManager.IndependentResolution.VirtualResolution.X); tmpImages.Add(img); i++; position.Y = img.Position.Y + (img.SourceRectangle.Height*img.Scale.Y); } _scoresImageFiles = tmpImages; } catch (Exception exception) { Debug.WriteLine("Error trying to load highscores: {0}", exception.StackTrace); var cantLoadScoresImage = new ImageFile {Text = Strings.HIGH_SCORES_NOT_AVAILABLE}; cantLoadScoresImage.LoadContent(Content); cantLoadScoresImage.CenterX(GameManager.IndependentResolution.VirtualResolution.X); _scoresImageFiles = new List<ImageFile>{cantLoadScoresImage}; } }
public SplashScreen(GameManager gameManager) : base(gameManager) { _splashImage = new ImageFile{ ImagePath = @"Images\Splash", Position = new Vector2(640,360), }; }
public MenuItem(string text, LinkType linkType, Action executeAction) { LinkType = linkType; ExecuteAction = executeAction; FadeEffect = new FadeImageEffect{FadeSpeed = 1.0f}; Image = new ImageFile{Text = text}; Image.ActivateEffect(FadeEffect); }
private void AddLoadingImage() { var img = new ImageFile {Text = Strings.LOADING}; var fadeEffect = new FadeImageEffect(); img.LoadContent(Content); img.Position = new Vector2(0, _highScores.Position.Y + (_highScores.SourceRectangle.Height * _highScores.Scale.Y) + 20); img.CenterX(GameManager.IndependentResolution.VirtualResolution.X); img.ActivateEffect(fadeEffect); _scoresImageFiles.Add(img); }
public HighScoresScreen(GameManager gameManager) : base(gameManager) { _highScores = new ImageFile { Text = Strings.HIGH_SCORES, Scale = new Vector2(2f, 2f) }; _menu = new Menu(gameManager, new[] { new MenuItem(Strings.NEW_GAME, LinkType.Transition, () => gameManager.ChangeScreen("DemoLevelScreen")), new MenuItem(Strings.OPTIONS, LinkType.Transition, () => gameManager.ChangeScreen("OptionsMenuScreen")) }); _scoresImageFiles = new List<ImageFile>(); }
public GameOverScreen(GameManager gameManager) : base(gameManager) { _menu = new Menu(gameManager, new[] { new MenuItem(Strings.UPLOAD_SCORE, LinkType.Switch, UploadGameScore), new MenuItem(Strings.HIGH_SCORES, LinkType.Transition, () => gameManager.ChangeScreen("HighScoresScreen")), new MenuItem(Strings.NEW_GAME, LinkType.Transition, () => gameManager.ChangeScreen("DemoLevelScreen")), new MenuItem(Strings.OPTIONS, LinkType.Transition, () => gameManager.ChangeScreen("OptionsMenuScreen")), }); _gameOver = new ImageFile { Text = Strings.GAME_OVER, Scale = new Vector2(2f, 2f) }; _score = new ImageFile { Text = String.Format("{0}: {1}", Strings.YOUR_SCORE, gameManager.PlayerStats.CurrentScore) }; _highScore = new ImageFile { Text = String.Format("{0}: {1}", Strings.YOUR_HIGH_SCORE, gameManager.PlayerStats.HighScore) }; }
public Player(GameManager gameManager) { _gameManager = gameManager; var initialPosition = new Vector2(300, 350); _playerImage = new ImageFile { ImagePath = @"Images\Player", Position = initialPosition, }; _animationEffect = new SpriteSheetEffect(new Vector2(4, 2), 100); _rotateImageEffect = new RotateImageEffect(180, 100) { IsActive = false }; _playerImage.ActivateEffect(_animationEffect); _playerImage.ActivateEffect(_rotateImageEffect); _playerDieSound = new SoundFile(gameManager.SoundManager, @"Effects\Crash"); _changePlayerSound = new SoundFile(gameManager.SoundManager, @"Effects\Change"); _wingFlappingSound = new SoundFile(gameManager.SoundManager, @"Effects\WingFlapping"); _currentType = gameManager.PlayerStats.CurrentPlayerType; }
public GameHud(GameManager gameManager, params GameObjectType[] availableTypes) { _gameManager = gameManager; _playerSelectionAir = new ImageFile { Scale = new Vector2(0.5f, 0.5f), Alpha = 0.5f, ImagePath = @"Images\AirPlayerIcon", Position = new Vector2(200, 50), IsVisible = availableTypes.Contains(GameObjectType.Air) }; _playerSelectionFire = new ImageFile { Scale = new Vector2(0.5f, 0.5f), Alpha = 0.5f, ImagePath = @"Images\FirePlayerIcon", Position = new Vector2(60, 50), IsVisible = availableTypes.Contains(GameObjectType.Fire) }; _currentScore = new ImageFile { Alpha = 0.5f, Position = new Vector2(1200, 10) }; }
public virtual void LoadContent(ref ImageFile image) { Image = image; }