示例#1
0
 public void SelectCharacter(Character2D NewCharacter, bool IsForce = false)
 {
     if (SelectedCharacter != NewCharacter || IsForce)
     {
         if (SelectedCharacter != null)
         {
             SelectedCharacter.OnHealthUpdatedEvent.RemoveListener(OnHealthUpdated);
             SelectedCharacter.OnHealthRegenUpdatedEvent.RemoveListener(OnHealthRegenUpdated);
         }
         SelectedCharacter = NewCharacter;
         if (SelectedCharacter)
         {
             MyTabs.SelectSelect();
             gameObject.SetActive(true);
             IsSelected = true;
             SelectedCharacter.OnHealthUpdatedEvent.AddListener(OnHealthUpdated);
             SelectedCharacter.OnHealthRegenUpdatedEvent.AddListener(OnHealthRegenUpdated);
             OnNameUpdated();
             OnHealthUpdated();
             OnHealthRegenUpdated();
             OnDamageUpdated();
             OnAttackSpeedUpdated();
             OnRangeUpdated();
             OnVisionUpdated();
         }
         else
         {
             NameText.text = "None Selected";
             gameObject.SetActive(false);
         }
     }
 }