void UnregisterEventCallbacks() { DeathEventInfo.UnregisterListener(OnUnitDied); HPChangedEventInfo.UnregisterListener(OnHPChange); MPChangedEventInfo.UnregisterListener(OnMPChange); UnitSpawnEventInfo.UnregisterListener(OnUnitSpawn); CharacterTurnOverEventInfo.UnregisterListener(OnTurnOver); }
public void UnregisterEventCallbacks() { SelectedObjectEventInfo.UnregisterListener(OnHighlightSelected); CharacterReadyEventInfo.UnregisterListener(OnCharacterReady); BattleWonEventInfo.UnregisterListener(OnBattleWon); HPChangedEventInfo.UnregisterListener(OnHPChange); MPChangedEventInfo.UnregisterListener(OnMPChange); HeroDeathEventInfo.UnregisterListener(OnHeroDeath); DeathEventInfo.UnregisterListener(OnUnitDied); UnitSpawnEventInfo.UnregisterListener(OnUnitSpawn); }
//TODO... Look into the way HP and Mana is passed on for Hero's monsters. // Currently this is required to ensure persistance between battles. // I would prefer if this step was removed in favour of it being handled at battle end, like Hero HP and Mana // This updates the player's MonsterList info with the new HP for the monsters void OnHPChange(HPChangedEventInfo hpChangedEventInfo) { Debug.Log("CombatManager Alerted to Character HP Change: " + hpChangedEventInfo.UnitGO.name); // We only care about freindly monsters at this point if (hpChangedEventInfo.UnitGO.GetComponent <Character>().GetTeam == TeamName.Friendly) { string uID = hpChangedEventInfo.UnitGO.GetComponent <Character>().GetUniqueID; // Also, we only care about monsters in our playerMonsterInfoList (i.e NOT the hero) <- this is because the hero damage is tracked differently. if (playerMonsterinfoList.ContainsKey(uID)) { playerMonsterinfoList[hpChangedEventInfo.UnitGO.GetComponent <Character>().GetUniqueID].CurrentHP = hpChangedEventInfo.UnitGO.GetComponent <Character>().GetHP; // Update Summon Menu ActionMenu menu = monsterSpawner.PopulateHeroSummonMenu(GameManager.Instance.GetHeroData.heroWrapper.HeroData.HeroInfo); playerCharacters[GameManager.Instance.GetHeroData.heroWrapper.HeroData.HeroInfo.PlayerName].GetComponent <Hero>().SetMenu(menu); } } }
void OnHPChange(HPChangedEventInfo hpChangedEventInfo) { Debug.Log("BattleUIController Alerted to Character HP Change: " + hpChangedEventInfo.UnitGO.name); UpdateCharacterPanelHP(hpChangedEventInfo.UnitGO); }