private void SetupCombat(Player player, BaseEnemy enemy) { GetNode <TextureRect>("Background").Texture = Backgrounds.RandomElement(); AudioSystem.StopAllMusic(); _playerCombat.CharacterInstance = player; _enemyCombat.CharacterInstance = enemy; _combatMenu.currentMenu = CombatMenu.Menu.Main; _combatMenu.ResetUI(); _playerInstance = player; _enemyInstance = enemy; if (!_playerInstance.IsConnected(nameof(BaseEntity.HealthChanged), _combatMenu, nameof(_combatMenu.UpdatePlayerHealthValue))) { _playerInstance.Connect(nameof(BaseEntity.HealthChanged), _combatMenu, nameof(_combatMenu.UpdatePlayerHealthValue)); } if (!_enemyInstance.IsConnected(nameof(BaseEntity.HealthChanged), _combatMenu, nameof(_combatMenu.UpdateEnemyHealthValue))) { _enemyInstance.Connect(nameof(BaseEntity.HealthChanged), _combatMenu, nameof(_combatMenu.UpdateEnemyHealthValue)); } if (!_enemyCombat.IsConnected(nameof(CombatChar.DamageTaken), this, nameof(OnEnemy_TakeDamage))) { _enemyCombat.Connect(nameof(CombatChar.DamageTaken), this, nameof(OnEnemy_TakeDamage)); } _combatMenu.SetPlayerHealthValue(_playerInstance.maxHealth, _playerInstance.Health); _combatMenu.SetEnemyHealthValue(_enemyInstance.Stat.MaxHealth, _enemyInstance.Health); var weaponName = _playerInstance.EquippedWeapon; var weaponTexture = GD.Load <Texture>(string.Format(WeaponTexturePath, weaponName.ToLower())); if (weaponTexture == null) { GD.PushWarning($"Weapon Battle sprite for {weaponName} not found"); } _combatMenu.playerWeapon.Texture = weaponTexture; ((AtlasTexture)_combatMenu.enemyImage.Texture).Atlas = _enemyInstance.battleTexture; ((AtlasTexture)_combatMenu.enemyImage.Texture).Region = new Rect2( CombatAnimationUtil.AnimationStateRegionPositionX[ CombatAnimationUtil.AnimationState.Normal], CombatAnimationUtil.BattleTexturePosY, CombatAnimationUtil.BattleTextureWidth, CombatAnimationUtil.BattleTextureHeight); StartCombat(); }