Add debug floors, fix boss battle A crashes (need to reimplement the fight anyway)
This commit is contained in:
@@ -37,11 +37,11 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
#region Node Dependencies
|
||||
[Node] private CollisionShape3D _collisionShape { get; set; } = default!;
|
||||
|
||||
[Node] private Area3D _lineOfSight { get; set; } = default!;
|
||||
[Node] private Area3D LineOfSight { get; set; } = default!;
|
||||
|
||||
[Node] protected Timer _attackTimer { get; set; } = default!;
|
||||
|
||||
[Node] private RayCast3D _raycast { get; set; } = default!;
|
||||
[Node] private RayCast3D Raycast { get; set; } = default!;
|
||||
|
||||
[Node] protected IEnemyModelView _enemyModelView { get; set; } = default!;
|
||||
#endregion
|
||||
@@ -86,7 +86,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
CurrentHP = new AutoProp<double>(_enemyStatResource.MaximumHP);
|
||||
CurrentHP.Sync += OnHPChanged;
|
||||
_lineOfSight.BodyEntered += LineOfSight_BodyEntered;
|
||||
LineOfSight.BodyEntered += LineOfSight_BodyEntered;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
@@ -233,18 +233,18 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
private void LineOfSight_BodyEntered(Node3D body)
|
||||
{
|
||||
var overlappingBodies = _lineOfSight.GetOverlappingBodies();
|
||||
var overlappingBodies = LineOfSight.GetOverlappingBodies();
|
||||
foreach (var _ in overlappingBodies)
|
||||
{
|
||||
if (_raycast.GlobalPosition != _player.CurrentPosition)
|
||||
_raycast.LookAt(_player.CurrentPosition, Vector3.Up);
|
||||
_raycast.ForceRaycastUpdate();
|
||||
if (_raycast.IsColliding())
|
||||
if (Raycast.GlobalPosition != _player.CurrentPosition)
|
||||
Raycast.LookAt(_player.CurrentPosition, Vector3.Up);
|
||||
Raycast.ForceRaycastUpdate();
|
||||
if (Raycast.IsColliding())
|
||||
{
|
||||
var collider = _raycast.GetCollider();
|
||||
var collider = Raycast.GetCollider();
|
||||
if (collider is IPlayer)
|
||||
{
|
||||
_raycast.DebugShapeCustomColor = Color.FromString("Purple", Colors.Purple);
|
||||
Raycast.DebugShapeCustomColor = Color.FromString("Purple", Colors.Purple);
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user