public void Construct(IShipModel model, IShipView view, IMovingComponent movingComponent) { _model = model; _view = view; _movingComponent = movingComponent; _movingComponent.onMoving += OnMoving; _movingComponent.onFinishMoving += OnFinishedMoving; }
public ShipPresenter(IShipView view, ShipModel model) { this.view = view; this.model = model; view.AddOnUpdateListener(this); model.SetOnZeroHealthListener(OnZeroHealth); model.SetOnFullShield(OnFullShield); model.SetOnChangeHealth(onChangeHealth); model.SetOnChangeShield(onChangeShield); view.SetMaxHealth(model.MaxHealth); view.SetMaxShield(model.MaxShield); }
//====================================================================== /// <summary> /// Initializes a new instance of the <see cref="CgfGames.ShipCtrl"/> /// class. /// </summary> /// <param name="view">View.</param> public ShipCtrl(IShipView view) { // Init properties this.View = view; this.IsAlive = true; this.IsActive = true; // Register vor view events this.View.HitEvent += this.Destroyed; this.View.NewWeaponEvent += this.Equip; // Init the weapons this.InitWeapons(); }