void SetUI(WeaponItem item) { bool enable = item != null; m_IconImg.gameObject.SetActive(enable); m_NameTxt.gameObject.SetActive(enable); m_DamageTxt.gameObject.SetActive(enable); if (!enable) { return; } m_IconImg.sprite = item.Icon; m_NameTxt.ReplaceText("{name}", item.WeaponName); m_DamageTxt.ReplaceText("{damage}", item.Damage.ToString()); }
private void SwitchWeapon(int input) { input -= 1; WeaponItem weapon = null; if (input < m_Weapon.Length) { weapon = m_Weapon[input]; Debugger.DebugLog($"切換到武器: {weapon.WeaponName}"); m_OnAttack = weapon.OnAttack; } else { Debugger.DebugLog($"切換到近戰"); m_OnAttack = FistAttack; } m_OnWeaponSwitch?.Invoke(weapon); }