Refactor NPC spawning logic and adjust grid size; remove unused power-up type

This commit is contained in:
2025-12-13 02:59:59 +01:00
parent 0e86d2f4f9
commit 1ae7190fd3
6 changed files with 72 additions and 18 deletions

View File

@@ -18,9 +18,11 @@ namespace Infrastructure.Unity
private Vector3 _currentDir;
private float _timer;
private Func<float> _timeDilationProvider;
private Action _onPlayerHit;
public void Initialize(Func<float> timeDilationProvider)
public void Initialize(Func<float> timeDilationProvider, Action onPlayerHit)
{
_onPlayerHit = onPlayerHit;
_timeDilationProvider = timeDilationProvider;
}
@@ -70,5 +72,14 @@ namespace Infrastructure.Unity
case 3: _currentDir = Vector3.right; break;
}
}
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.TryGetComponent<PlayerController>(out var player))
{
_onPlayerHit?.Invoke();
Destroy(gameObject);
}
}
}
}