Example #1
0
 public override void RestartLevel(LevelManagerViewModel levelManager)
 {
     if (!levelManager.Player.IsAlive)
     {
         base.RestartLevel(levelManager);
         levelManager.GameOver = false;
         this.ExecuteCommand(levelManager.Player.Restart);
     }
 }
    protected override void InitializeViewModel(ViewModel viewModel)
    {
        LevelManagerViewModel levelManager = ((LevelManagerViewModel)(viewModel));

        levelManager.Player           = this._Player == null ? null : this._Player.ViewModelObject as PlayerShipViewModel;
        levelManager.SpawnPoint       = this._SpawnPoint;
        levelManager.GameOver         = this._GameOver;
        levelManager.NotificationText = this._NotificationText;
    }
 public override void RestartLevel(LevelManagerViewModel levelManager)
 {
     if (!levelManager.Player.IsAlive)
     {
         base.RestartLevel(levelManager);
         levelManager.GameOver = false;
         this.ExecuteCommand(levelManager.Player.Restart);
     }
 }
Example #4
0
    public override void InitializeLevelManager(LevelManagerViewModel levelManager)
    {
        levelManager.GameOver = false;

        //this can be disabled andd restarted when game is over/restarted
        //generate asteroid every x seconds
        Observable.Interval(TimeSpan.FromMilliseconds(1000)).Subscribe(x =>
        {
            var asteroid = AsteroidController.CreateAsteroid();
            asteroid.Destroy.Subscribe(_ => { levelManager.Asteroids.Remove(asteroid); });
            levelManager.Asteroids.Add(asteroid);
        });

        //we should not chage the gameover property from outside of the level manager !
        //we should make a game over computed property which will determine if the game is over
        levelManager.PlayerProperty
        .Where(player => player != null)
        .Subscribe(player => player.IsAliveProperty.Where(isAlive => !isAlive).Subscribe(_ => { levelManager.GameOver = true; }))
        .DisposeWith(levelManager);
    }
    public override void InitializeLevelManager(LevelManagerViewModel levelManager)
    {
        levelManager.GameOver = false;

        //this can be disabled andd restarted when game is over/restarted
        //generate asteroid every x seconds
        Observable.Interval(TimeSpan.FromMilliseconds(1000)).Subscribe(x =>
        {
            var asteroid = AsteroidController.CreateAsteroid();
            asteroid.Destroy.Subscribe(_ => { levelManager.Asteroids.Remove(asteroid); });
            levelManager.Asteroids.Add(asteroid);
        });

        //we should not chage the gameover property from outside of the level manager !
        //we should make a game over computed property which will determine if the game is over
        levelManager.PlayerProperty
            .Where(player => player != null)
            .Subscribe(player => player.IsAliveProperty.Where(isAlive => !isAlive).Subscribe(_ => { levelManager.GameOver = true; }))
            .DisposeWith(levelManager);
    }
 public virtual void ShowNotification(LevelManagerViewModel levelManager, String arg)
 {
 }
 public virtual void RestartLevel(LevelManagerViewModel levelManager)
 {
 }
 public abstract void InitializeLevelManager(LevelManagerViewModel levelManager);
Example #9
0
 public virtual void ShowNotification(LevelManagerViewModel levelManager, String arg)
 {
 }
Example #10
0
 public virtual void RestartLevel(LevelManagerViewModel levelManager)
 {
 }
Example #11
0
 public abstract void InitializeLevelManager(LevelManagerViewModel levelManager);
Example #12
0
 public override void ShowNotification(LevelManagerViewModel levelManager, string arg)
 {
     levelManager.NotificationText = arg;
     base.ShowNotification(levelManager, arg);
 }
 public override void ShowNotification(LevelManagerViewModel levelManager, string arg)
 {
     levelManager.NotificationText = arg;
     base.ShowNotification(levelManager, arg);
 }