private void Start() { GameObject player = GameObject.FindWithTag("Player"); SampleCharacterController scc = player.GetComponent <SampleCharacterController>(); ammo = scc.Weapon.Ammo; maxAmmo = ammo.CurrentValue; ammo.OnValueChanged += OnValueChanged; hudText.text = string.Format("{0} / {1}", ammo.CurrentValue, maxAmmo); }
private void Start() { GameObject player = GameObject.FindWithTag("Player"); SampleCharacterController scc = player.GetComponent <SampleCharacterController>(); ammo = scc.Weapon.Ammo; maxAmmo = ammo.CurrentValue; ammo.onValueChanged += OnValueChanged; OnValueChanged(ammo.CurrentValue); }