Barrier
This commit is contained in:
@@ -22,6 +22,7 @@ public partial class DummyPlayer : CharacterBody3D, IPlayer
|
||||
public float HealthTimerSpeedModifier { get; }
|
||||
public bool AutoIdentifyItems { get; set; }
|
||||
public IStatusEffectComponent StatusEffectComponent { get; }
|
||||
public bool BriefImmunity { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public event Action PlayerDied;
|
||||
|
||||
@@ -41,4 +42,5 @@ public partial class DummyPlayer : CharacterBody3D, IPlayer
|
||||
public void TeleportPlayer((Vector3 Rotation, Vector3 Position) newTransform) => throw new NotImplementedException();
|
||||
public void Unequip(IEquipableItem equipable) => throw new NotImplementedException();
|
||||
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => throw new NotImplementedException();
|
||||
public void EnactBriefImmunity() => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -101,6 +101,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
[Node] private ShakeCamera _camera3D { get; set; } = default!;
|
||||
|
||||
[Node] private Barrier Barrier { get; set; } = default!;
|
||||
|
||||
[Node] private ProjectileSystem _airReactorProjectileSystem { get; set; } = default!;
|
||||
[Node] private ProjectileSystem _fireReactorProjectileSystem { get; set; } = default!;
|
||||
[Node] private ProjectileSystem _waterReactorProjectileSystem { get; set; } = default!;
|
||||
@@ -116,6 +118,12 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
[Export]
|
||||
public bool AutoIdentifyItems { get; set; } = false;
|
||||
|
||||
[Export]
|
||||
public bool BriefImmunity { get; set; } = false;
|
||||
|
||||
[Export]
|
||||
private float _immunityTime { get; set; } = 30f;
|
||||
|
||||
[Export]
|
||||
public float HealthTimerSpeedModifier { get; set; } = 1f;
|
||||
|
||||
@@ -137,6 +145,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
private PlayerEffectService _playerEffectService;
|
||||
|
||||
private Timer _projectileCooldownTimer;
|
||||
private Timer _immunityTimer;
|
||||
private bool _fired;
|
||||
|
||||
public void Initialize()
|
||||
@@ -212,9 +221,21 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
_projectileCooldownTimer.WaitTime = 1.8f;
|
||||
_projectileCooldownTimer.Timeout += ProjectileCooldown;
|
||||
|
||||
_immunityTimer = new Timer();
|
||||
AddChild(_immunityTimer);
|
||||
_immunityTimer.WaitTime = _immunityTime;
|
||||
_immunityTimer.Timeout += _immunityTimer_Timeout;
|
||||
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
}
|
||||
|
||||
private void _immunityTimer_Timeout()
|
||||
{
|
||||
BriefImmunity = false;
|
||||
Barrier.FadeOut();
|
||||
SfxDatabase.Instance.Play(SoundEffect.Debuff);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void Activate()
|
||||
@@ -266,6 +287,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
public void TakeDamage(AttackData damage)
|
||||
{
|
||||
if (BriefImmunity)
|
||||
return;
|
||||
|
||||
_camera3D.AddShake(1.0f);
|
||||
TakeDamageAnimationPlayer.Play("take_damage");
|
||||
var damageReceived = DamageCalculator.CalculateDamage(damage, TotalDefense, EquipmentComponent.ElementalResistance);
|
||||
@@ -649,6 +673,14 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
HealthComponent.LowerMaximumHP(hpIncrease);
|
||||
}
|
||||
|
||||
public void EnactBriefImmunity()
|
||||
{
|
||||
SfxDatabase.Instance.Play(SoundEffect.Buff);
|
||||
BriefImmunity = true;
|
||||
Barrier.FadeIn();
|
||||
_immunityTimer.Start();
|
||||
}
|
||||
|
||||
private static float LeftStrafeInputVector => Godot.Input.GetActionStrength(GameInputs.StrafeLeft);
|
||||
|
||||
private static float RightStrafeInputVector => Godot.Input.GetActionStrength(GameInputs.StrafeRight);
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user