Beispiel #1
0
        public void Execute(PlayerHitSignal playerHitSignal)
        {
            playerShipModel.Hp.Value--;

            if (playerShipModel.Hp.Value <= 0)
            {
                gameStateModel.State = GameState.GAME_OVER;
            }
        }
Beispiel #2
0
 protected override void UnmapBindings()
 {
     AddScoreSignal.RemoveCommand <AddScoreCommand>();
     PlayerHitSignal.RemoveCommand <PlayerHitCommand>();
     EnemyHitSignal.RemoveCommand <EnemyHitCommand>();
     GameOverSignal.RemoveCommand <GameOverCommand>();
     Rapid.Unbind <AddScoreSignal>(ContextName);
     Rapid.Unbind <GameOverSignal>(ContextName);
     Rapid.Unbind <PlayerHitSignal>(ContextName);
     Rapid.Unbind <EnemyHitSignal>(ContextName);
     Rapid.Unbind("EntityRoot", ContextName);
 }
Beispiel #3
0
 public void Construct(
     PlayerModel playerModel,
     PlayableShip shipView,
     InputReceivedSignal inputReceivedSignal,
     PlayerHitSignal playerHitSignal,
     PlayerDeathSignal playerDeathSignal)
 {
     _playerModel         = playerModel;
     _shipView            = shipView;
     _inputReceivedSignal = inputReceivedSignal;
     _playerHitSignal     = playerHitSignal;
     _playerDeathSignal   = playerDeathSignal;
 }
Beispiel #4
0
        protected override void MapBindings()
        {
            base.MapBindings();

            Rapid.Bind <AddScoreSignal>(ContextName);
            Rapid.Bind <GameOverSignal>(ContextName);
            Rapid.Bind <PlayerHitSignal>(ContextName);
            Rapid.Bind <EnemyHitSignal>(ContextName);
            // this is where we spawn our game entities
            Rapid.Bind("EntityRoot", transform.Find("EntityRoot").gameObject, ContextName);
            AddScoreSignal.AddCommand <AddScoreCommand>();
            PlayerHitSignal.AddCommand <PlayerHitCommand>();
            EnemyHitSignal.AddCommand <EnemyHitCommand>();
            GameOverSignal.AddCommand <GameOverCommand>();
        }
 private void OnPlayerHit(PlayerHitSignal obj)
 {
     playerShipModel.Hp.Value--;
 }
Beispiel #6
0
 public void Dispose()
 {
     _inputReceivedSignal -= OnReceiveInput;
     _playerHitSignal     -= _playerModel.TakeDamage;
 }
Beispiel #7
0
 public void Initialize()
 {
     _inputReceivedSignal += OnReceiveInput;
     _playerHitSignal     += _playerModel.TakeDamage;
 }
Beispiel #8
0
 public virtual void Construct(PlayerHitSignal playerHitSignal)
 {
     _playerHitSignal = playerHitSignal;
 }