Navigation and shooting modules

This commit is contained in:
Marco 2025-03-20 19:28:40 +01:00
commit 5a6d31e2f0
8 changed files with 229 additions and 11 deletions

View file

@ -35,7 +35,9 @@ public partial class PlayerDetectionModule : Area2D
public bool IsPlayerInRange(float range)
{
if (!GameManager.Instance?.PlayerPosition.HasValue ?? false)
if (GameManager.Instance is null) return false;
if (!GameManager.Instance.PlayerPosition.HasValue)
{
return false;
}
@ -45,8 +47,9 @@ public partial class PlayerDetectionModule : Area2D
public bool IsPlayerInSight()
{
if (GameManager.Instance is null) return false;
//if (_cachedPlayer == null) return false;
if (!GameManager.Instance?.PlayerPosition.HasValue ?? false) return false;
if (!GameManager.Instance.PlayerPosition.HasValue) return false;
var spaceState = GetWorld2D().DirectSpaceState;