コード例 #1
0
        public void Construct(IShipModel model, IShipView view, IMovingComponent movingComponent)
        {
            _model = model;
            _view  = view;

            _movingComponent                 = movingComponent;
            _movingComponent.onMoving       += OnMoving;
            _movingComponent.onFinishMoving += OnFinishedMoving;
        }
コード例 #2
0
 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);
 }
コード例 #3
0
ファイル: ShipCtrl.cs プロジェクト: CarlosGines/Asteroids
        //======================================================================

        /// <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();
        }