fixed level loading and starting to setup proper gyms, zoos and playtest levels
All checks were successful
All checks were successful
This commit is contained in:
@@ -354,6 +354,13 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public float CurrentHealth { get; set; }
|
||||
|
||||
private bool _isInvincible;
|
||||
public bool IsInvincibleOverride { get; set; }
|
||||
public bool IsInvincible
|
||||
{
|
||||
get => _isInvincible || IsInvincibleOverride;
|
||||
set => _isInvincible = value;
|
||||
}
|
||||
|
||||
private readonly List<IDamageable> _hitEnemies = new List<IDamageable>();
|
||||
|
||||
private ShapeCast3D _closeEnemyDetector;
|
||||
@@ -1438,7 +1445,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
SetupSlideCollision();
|
||||
|
||||
SlidingEnemyDetector.Monitoring = true;
|
||||
_isInvincible = true;
|
||||
IsInvincible = true;
|
||||
}
|
||||
|
||||
public bool CanStandUpFromSlide()
|
||||
@@ -1565,7 +1572,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public void SlideEnded()
|
||||
{
|
||||
SlidingEnemyDetector.Monitoring = false;
|
||||
_isInvincible = false;
|
||||
IsInvincible = false;
|
||||
|
||||
SetupStandingCollision();
|
||||
_audioStream!.SwitchToClipByName("footsteps");
|
||||
@@ -2002,7 +2009,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
public DamageRecord TakeDamage(DamageRecord damageRecord)
|
||||
{
|
||||
if (_isInvincible)
|
||||
if (IsInvincible)
|
||||
return damageRecord with { Damage = new RDamage(0, damageRecord.Damage.DamageType) };
|
||||
|
||||
var finalDamage = CDamageable.TakeDamage(damageRecord);
|
||||
@@ -2023,7 +2030,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
public void OnHitInvincibility()
|
||||
{
|
||||
_isInvincible = true;
|
||||
IsInvincible = true;
|
||||
_invincibilityTimer.Start();
|
||||
}
|
||||
|
||||
@@ -2041,14 +2048,13 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_audioStream!.SwitchToClipByName("parry");
|
||||
}
|
||||
|
||||
// TODO: fix repeated code and improve parry knockback
|
||||
private PhysicsDirectSpaceState3D _spaceState;
|
||||
|
||||
public void StartDashAction(bool isParry)
|
||||
{
|
||||
var streamName = isParry ? "parry" : "attacks";
|
||||
_audioStream!.SwitchToClipByName(streamName);
|
||||
_isInvincible = true;
|
||||
IsInvincible = true;
|
||||
|
||||
var plannedDashLocation = _targetLocation + Vector3.Down*HeadSystem.Position.Y;
|
||||
var query = PhysicsRayQueryParameters3D.Create(HeadSystem.GlobalPosition, plannedDashLocation, DashSystem.DashCast3D.CollisionMask);
|
||||
@@ -2058,7 +2064,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
plannedDashLocation = (Vector3) result["position"];
|
||||
}
|
||||
|
||||
var travel = plannedDashLocation - (GlobalPosition + Vector3.Up*_playerHeight);
|
||||
var travel = plannedDashLocation - (GlobalPosition + Vector3.Up*_playerHeight/2);
|
||||
_preDashVelocity = Velocity;
|
||||
_dashDirection = travel.Normalized();
|
||||
var dashTween = CreatePositionTween(plannedDashLocation, AimedDashTime);
|
||||
@@ -2085,7 +2091,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
stunnable.Stun();
|
||||
}
|
||||
_isInvincible = false;
|
||||
IsInvincible = false;
|
||||
_playerState.SendEvent("attack_finished");
|
||||
}
|
||||
|
||||
@@ -2205,9 +2211,10 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
public void ResetInvincibility()
|
||||
{
|
||||
_isInvincible = false;
|
||||
IsInvincible = false;
|
||||
}
|
||||
|
||||
|
||||
// Sound
|
||||
public void OnFootStepped()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user