/// <summary> /// Called once per frame /// </summary> void Update() { // Health if (_characterStatus.CurrentHealth != _healthBar.CurrentValue) { _healthBar.CurrentValue = _characterStatus.CurrentHealth; } if (_characterStatus.Data.MaxHealth != _healthBar.MaximumValue) { _healthBar.MaximumValue = _characterStatus.Data.MaxHealth; } // Magic if (_characterStatus.CurrentMagic != _magicBar.CurrentValue) { _magicBar.CurrentValue = _characterStatus.CurrentMagic; } if (_characterStatus.Data.MaxMagic != _magicBar.MaximumValue) { _magicBar.MaximumValue = _characterStatus.Data.MaxMagic; } // Primary Weapon if (_playerWeapons.GetWeaponIndex(0) != _primaryWeaponIndex) { _primaryWeaponIndex = _playerWeapons.GetWeaponIndex(0); if (_primaryWeaponIndex >= 0) { var weapon = _playerWeapons.GetWeapon(0).WeaponObject; _primaryWeapon.enabled = true; _primaryWeapon.sprite = Sprite.Create(weapon.Data.Icon, new Rect(0, 0, weapon.Data.Icon.width, weapon.Data.Icon.height), new Vector2(0.5f, 0.5f), weapon.Data.Icon.height); } else { _primaryWeapon.enabled = false; } } // Secondary Weapon if (_playerWeapons.GetWeaponIndex(1) != _secondaryWeaponIndex) { _secondaryWeaponIndex = _playerWeapons.GetWeaponIndex(1); if (_secondaryWeaponIndex >= 0) { var weapon = _playerWeapons.GetWeapon(1).WeaponObject; _secondaryWeapon.enabled = true; _secondaryWeapon.sprite = Sprite.Create(weapon.Data.Icon, new Rect(0, 0, weapon.Data.Icon.width, weapon.Data.Icon.height), new Vector2(0.5f, 0.5f), weapon.Data.Icon.height); } else { _secondaryWeapon.enabled = false; } } }