Implement jump mechanics and refine ground detection; adjust gravity application for improved player control
This commit is contained in:
@@ -23,10 +23,6 @@ namespace Infrastructure.Unity
|
||||
[SerializeField] private HunterNpcController hunterNpcPrefab;
|
||||
[SerializeField] private FloorVisibilityManager floorVisibilityManager;
|
||||
|
||||
[Header("Level Generation")]
|
||||
[SerializeField] private int floorsCount = 3;
|
||||
[SerializeField] private float floorHeightDistance = 15f;
|
||||
|
||||
[Header("Ui")]
|
||||
[SerializeField] private TMP_Text scoreText;
|
||||
[SerializeField] private TMP_Text highScoreText;
|
||||
@@ -70,7 +66,9 @@ namespace Infrastructure.Unity
|
||||
|
||||
// Set Theme based on High Score
|
||||
ThemeManager.CurrentTheme = ThemeManager.GetTheme(_gameSession.HighScore);
|
||||
|
||||
|
||||
var floorsCount = levelGenerator ? levelGenerator.FloorsCount : 1;
|
||||
|
||||
if (levelGenerator)
|
||||
{
|
||||
levelGenerator.Generate(soundManager, _allTiles, _tileViews, cameraController, rumbleManager);
|
||||
@@ -111,9 +109,12 @@ namespace Infrastructure.Unity
|
||||
// Calculate current floor index based on Y height (inverse logic from Generator)
|
||||
// Note: Generator uses negative offsets: 0, -15, -30.
|
||||
// So Floor 0 is at Y=0. Floor 1 is at Y=-15.
|
||||
|
||||
var heightDist = levelGenerator.FloorHeightDistance;
|
||||
var maxFloors = levelGenerator.FloorsCount;
|
||||
|
||||
var rawFloor = Mathf.RoundToInt(-playerY / floorHeightDistance);
|
||||
_currentPlayerFloorIndex = Mathf.Clamp(rawFloor, 0, floorsCount - 1);
|
||||
var rawFloor = Mathf.RoundToInt(-playerY / heightDist);
|
||||
_currentPlayerFloorIndex = Mathf.Clamp(rawFloor, 0, maxFloors - 1);
|
||||
|
||||
_gameSession.SetPlayerFloor(_currentPlayerFloorIndex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user