private float _attackVariable_2; // Used for multiple things such as charge and rotation etc... public override void _Ready() { _armStatus = new ArmStatus() { firstArmAlive = true, secondArmAlive = true, firstArmHealth = 1, secondArmHealth = 1 }; _firstArmHealthSetter = GetNode <HealthSetter>(firstArmNodePath); _secondArmHealthSetter = GetNode <HealthSetter>(secondArmNodePath); _firstArmSingleController = GetNode <BossSingleArmController>(firstArmSingleControllerNodePath); _secondArmSingleController = GetNode <BossSingleArmController>(secondArmSingleControllerNodePath); _firstArmAttackPosition = GetNode <Node2D>(firstArmAttackNodePath); _secondArmAttackPosition = GetNode <Node2D>(secondArmAttackNodePath); _dualArmAttackPosition = GetNode <Node2D>(dualArmAttackNodePath); _bulletHolder = GetNode <Node2D>(bulletHolderNodePath); _firstArmHealthSetter.healthChanged += HandleFirstArmHealthChange; _secondArmHealthSetter.healthChanged += HandleSecondArmHealthChange; // This is done as all child nodes fire their ready before the parent HandleFirstArmHealthChange(_firstArmHealthSetter.GetCurrentHealth(), _firstArmHealthSetter.GetMaxHealth()); HandleSecondArmHealthChange(_secondArmHealthSetter.GetCurrentHealth(), _secondArmHealthSetter.GetMaxHealth()); }
public void SwitchToBossScene() { float movementSpeed = _playerController.GetPlayerMovementSpeed(); float currentMaxHealth = _playerHealthSetter.GetMaxHealth(); float currentDamageDiff = _playerShooting.GetShootingDamageDiff(); PlayerVariables.PlayerCurrentMovementSpeed = movementSpeed; PlayerVariables.PlayerCurrentMaxHealth = currentMaxHealth; PlayerVariables.PlayerCurrentShootingDamageDiff = currentDamageDiff; GetTree().ChangeScene(BossScenePath); }
public override void _Ready() { _bodyStatus = new BodyStatus() { bodyDestroyed = false, bodyHealth = 1 }; _bossBodyHealthSetter = GetNode <HealthSetter>(bossBodyNodePath); _bossBodyHealthSetter.healthChanged += HandleBodyHealthChanged; HandleBodyHealthChanged(_bossBodyHealthSetter.GetCurrentHealth(), _bossBodyHealthSetter.GetMaxHealth()); }
public void HandleSacrificialItemInfluence(PlayerModifierTypes.SacrificialItemInfo sacrificialItemInfo) { switch (sacrificialItemInfo.sacrificialItem) { case PlayerModifierTypes.SacrificialItem.SpeedSacrificeHealthBoost: { float speedLossAmount = _currentMovementSpeed * sacrificialItemInfo.reducedPercent / 100; _currentMovementSpeed -= speedLossAmount; float maxHealthIncrease = _playerHealthSetter.GetMaxHealth() * sacrificialItemInfo.increasedPercent / 100; _playerHealthSetter.SetMaxHealth(_playerHealthSetter.GetMaxHealth() + maxHealthIncrease); } break; case PlayerModifierTypes.SacrificialItem.SpeedSacrificeDamageIncrease: { float speedLossAmount = _currentMovementSpeed * sacrificialItemInfo.reducedPercent / 100; _currentMovementSpeed -= speedLossAmount; _playerShooting.AddToDamageDifferencePercent(sacrificialItemInfo.increasedPercent); } break; case PlayerModifierTypes.SacrificialItem.HealthSacrificeDamageIncrease: { float healthLossAmount = _playerHealthSetter.GetMaxHealth() * sacrificialItemInfo.reducedPercent / 100; _playerHealthSetter.SetMaxHealth(_playerHealthSetter.GetMaxHealth() - healthLossAmount); _playerShooting.AddToDamageDifferencePercent(sacrificialItemInfo.increasedPercent); } break; case PlayerModifierTypes.SacrificialItem.ShootTimeSacrificeDamageIncrease: { _playerShooting.SetCurrentShootingDelay(sacrificialItemInfo.reducedPercent / 100.0f); _playerShooting.AddToDamageDifferencePercent(sacrificialItemInfo.increasedPercent); } break; case PlayerModifierTypes.SacrificialItem.HealthSacrificeSpeedIncrease: { float healthLossAmount = _playerHealthSetter.GetMaxHealth() * sacrificialItemInfo.reducedPercent / 100; _playerHealthSetter.SetMaxHealth(_playerHealthSetter.GetMaxHealth() - healthLossAmount); float speedIncrease = _currentMovementSpeed * sacrificialItemInfo.increasedPercent / 100; _currentMovementSpeed += speedIncrease; } break; case PlayerModifierTypes.SacrificialItem.SpeedSacrificeShieldTimeIncrease: { float speedLossAmount = _currentMovementSpeed * sacrificialItemInfo.reducedPercent / 100; _currentMovementSpeed -= speedLossAmount; _playerShieldController.IncrementShieldTimerByPercent(sacrificialItemInfo.increasedPercent); } break; case PlayerModifierTypes.SacrificialItem.HealthSacrificeShieldTimeIncrease: { float healthLossAmount = _playerHealthSetter.GetMaxHealth() * sacrificialItemInfo.reducedPercent / 100; _playerHealthSetter.SetMaxHealth(_playerHealthSetter.GetMaxHealth() - healthLossAmount); _playerShieldController.IncrementShieldTimerByPercent(sacrificialItemInfo.increasedPercent); } break; case PlayerModifierTypes.SacrificialItem.ShieldTimeSacrificeHealthBoost: { _playerShieldController.DecrementShieldTimerByPercent(sacrificialItemInfo.reducedPercent); float maxHealthIncrease = _playerHealthSetter.GetMaxHealth() * sacrificialItemInfo.increasedPercent / 100; _playerHealthSetter.SetMaxHealth(_playerHealthSetter.GetMaxHealth() + maxHealthIncrease); } break; case PlayerModifierTypes.SacrificialItem.ShieldTimeSacrificeSpeedIncrease: { _playerShieldController.DecrementShieldTimerByPercent(sacrificialItemInfo.reducedPercent); float speedIncrease = _currentMovementSpeed * sacrificialItemInfo.increasedPercent / 100; _currentMovementSpeed += speedIncrease; } break; default: throw new ArgumentOutOfRangeException(nameof(sacrificialItemInfo.sacrificialItem), sacrificialItemInfo.sacrificialItem, null); } }