/// <summary> /// Initializes a new instance of the /// <see cref="CgfGames.GameCtrl"/> class. /// </summary> /// <param name="gameState">Initial game state.</param> /// <param name="view">Associated view.</param> /// <param name="ship">The ship.</param> public GameCtrl(IGameStateCtrl gameState, IGameView view, IShipCtrl ship) { this.View = view; this.GameState = gameState; this.Ship = ship; this.AsteroidList = new List <IAsteroidCtrl> (); this.GameState.ScoreUpdatedEvent += this.ScoreUpdated; this.GameState.LivesUpdatedEvent += this.View.UpdateLives; this.Ship.DestroyedEvent += this.ShipDestroyed; }
//====================================================================== public SaucerCtrl(IGameStateCtrl gameState, ISaucerView view, IShipCtrl ship, int size) { this.GameState = gameState; this.View = view; this.Ship = ship; this.Size = size; this.View.RepeatFire(this.Fire, SHOT_PERIOD [size]); this.Ship.DestroyedEvent += this.ShipDestroyed; this.View.HitEvent += this.Destroyed; this.View.GoneEvent += this.Gone; }