コード例 #1
0
ファイル: Character2DGui.cs プロジェクト: Deus0/Zeltex2D
 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);
         }
     }
 }