Rework projectiles and fix some demon wall attacks
Still working on Demon Wall boss fight overall
This commit is contained in:
@@ -101,10 +101,11 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
[Node] private ShakeCamera _camera3D { get; set; } = default!;
|
||||
|
||||
[Node] private PlayerProjectile FireReactor { get; set; } = default!;
|
||||
[Node] private PlayerProjectile AirReactor { get; set; } = default!;
|
||||
[Node] private PlayerProjectile WaterReactor { get; set; } = default!;
|
||||
[Node] private PlayerProjectile PersuaderBullet { get; set; } = default!;
|
||||
[Node] private ProjectileSystem _airReactorProjectileSystem { get; set; } = default!;
|
||||
[Node] private ProjectileSystem _fireReactorProjectileSystem { get; set; } = default!;
|
||||
[Node] private ProjectileSystem _waterReactorProjectileSystem { get; set; } = default!;
|
||||
[Node] private ProjectileSystem _kineticProjectileSystem { get; set; } = default!;
|
||||
|
||||
[Node] private Sprite2D PersuaderCrosshair { get; set; } = default!;
|
||||
|
||||
#endregion
|
||||
@@ -135,6 +136,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
private ItemReroller _itemReroller;
|
||||
private PlayerEffectService _playerEffectService;
|
||||
|
||||
private Timer _projectileCooldownTimer;
|
||||
private bool _fired;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
var container = new SimpleInjector.Container();
|
||||
@@ -202,6 +206,12 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
ExperiencePointsComponent.PlayerLevelDown += OnLevelDown;
|
||||
PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished;
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
|
||||
_projectileCooldownTimer = new Timer();
|
||||
AddChild(_projectileCooldownTimer);
|
||||
_projectileCooldownTimer.WaitTime = 1.8f;
|
||||
_projectileCooldownTimer.Timeout += ProjectileCooldown;
|
||||
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
}
|
||||
@@ -591,6 +601,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
EquipmentComponent.UpdateEquipment(accessory);
|
||||
}
|
||||
|
||||
private void ProjectileCooldown() => _fired = false;
|
||||
|
||||
private static Vector3 GlobalInputVector
|
||||
{
|
||||
get
|
||||
@@ -670,29 +682,28 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
private void HandleProjectile(Weapon weapon)
|
||||
{
|
||||
if (_fired)
|
||||
return;
|
||||
|
||||
var ammo = EquipmentComponent.EquippedAmmo.Value as Ammo;
|
||||
if (ammo.Count == null || ammo.Count?.Value <= 0)
|
||||
return;
|
||||
|
||||
var fired = false;
|
||||
|
||||
if (weapon.WeaponTag == WeaponTag.ElementalProjectile)
|
||||
{
|
||||
if (ammo.AmmoElement == ElementType.Igneous)
|
||||
fired = FireReactor.Fire();
|
||||
if (ammo.AmmoElement == ElementType.Aeolic)
|
||||
fired = AirReactor.Fire();
|
||||
_airReactorProjectileSystem.Fire();
|
||||
if (ammo.AmmoElement == ElementType.Igneous)
|
||||
_fireReactorProjectileSystem.Fire();
|
||||
if (ammo.AmmoElement == ElementType.Hydric)
|
||||
fired = WaterReactor.Fire();
|
||||
_waterReactorProjectileSystem.Fire();
|
||||
}
|
||||
|
||||
if (weapon.WeaponTag == WeaponTag.KineticProjectile)
|
||||
{
|
||||
PlayAttackAnimation();
|
||||
fired = PersuaderBullet.Fire();
|
||||
_kineticProjectileSystem.Fire();
|
||||
}
|
||||
if (!fired)
|
||||
return;
|
||||
|
||||
ammo.SetCount(ammo.Count.Value - 1);
|
||||
EquipmentComponent.UpdateEquipment(ammo);
|
||||
@@ -701,6 +712,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
EquipmentComponent.Unequip(ammo);
|
||||
Inventory.Remove(ammo);
|
||||
}
|
||||
|
||||
_fired = true;
|
||||
_projectileCooldownTimer.Start();
|
||||
}
|
||||
|
||||
private void ThrowItem()
|
||||
|
||||
Reference in New Issue
Block a user