Exemple #1
0
 private void HandleSwitchingCharacter(object sender, SwitchCharacterFinishEventArgs e)
 {
     if (_selectedCharacterData.CharacterStatModel == null)
     {
         return;
     }
     if (_characterStatModel != null)
     {
         _characterStatModel.OnStatChanged -= HandleStatChanged;
     }
     _characterStatModel                = _selectedCharacterData.CharacterStatModel;
     _hudImageView.HudCharacterImage    = _selectedCharacterData.HudImageSprite;
     _characterStatModel.OnStatChanged += HandleStatChanged;
     _characterStatModel.InitializeStats();
 }
Exemple #2
0
 // Controller depends on interfaces for the model and view
 public HudController(ISelectedCharacterData selectedCharacterData, IHudImageView hudImageView,
                      IHudStatView hudStatView)
 {
     _selectedCharacterData = selectedCharacterData;
     _hudImageView          = hudImageView;
     _hudStatView           = hudStatView;
     _selectedCharacterData.OnSwitchingCharacterFinished += HandleSwitchingCharacter;
     if (_selectedCharacterData.CharacterStatModel == null)
     {
         return;
     }
     _characterStatModel = selectedCharacterData.CharacterStatModel;
     _characterStatModel.OnStatChanged += HandleStatChanged;
     _characterStatModel.InitializeStats();
 }