Add metadata files for LeanTween assets and update existing prefab references
This commit is contained in:
@@ -47,6 +47,8 @@ namespace Infrastructure.Unity
|
||||
private PlayerController _playerInstance;
|
||||
private GameObject _currentOrbInstance;
|
||||
private bool _isGameRunning;
|
||||
private int _currentPlayerFloorIndex;
|
||||
private int _currentDisplayedScore;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -110,14 +112,12 @@ namespace Infrastructure.Unity
|
||||
// Note: Generator uses negative offsets: 0, -15, -30.
|
||||
// So Floor 0 is at Y=0. Floor 1 is at Y=-15.
|
||||
|
||||
// Math to get positive index:
|
||||
var rawFloor = Mathf.RoundToInt(-playerY / floorHeightDistance);
|
||||
var currentFloor = Mathf.Clamp(rawFloor, 0, floorsCount - 1);
|
||||
_currentPlayerFloorIndex = Mathf.Clamp(rawFloor, 0, floorsCount - 1);
|
||||
|
||||
_gameSession.SetPlayerFloor(currentFloor);
|
||||
_gameSession.SetPlayerFloor(_currentPlayerFloorIndex);
|
||||
|
||||
// UPDATE VISIBILITY
|
||||
floorVisibilityManager.UpdateFloorVisibility(currentFloor);
|
||||
floorVisibilityManager.UpdateFloorVisibility(_currentPlayerFloorIndex);
|
||||
}
|
||||
|
||||
var dt = Time.deltaTime;
|
||||
@@ -161,13 +161,28 @@ namespace Infrastructure.Unity
|
||||
private void UpdateScoreUi(int newScore)
|
||||
{
|
||||
if (!scoreText) return;
|
||||
|
||||
LeanTween.cancel(scoreText.gameObject);
|
||||
|
||||
scoreText.rectTransform.localScale = Vector3.one;
|
||||
LeanTween.scale(scoreText.rectTransform, Vector3.one * 1.5f, 0.5f)
|
||||
.setEasePunch();
|
||||
|
||||
var combo = _gameSession?.ComboMultiplier ?? 1;
|
||||
var comboText = combo > 1 ? $" (x{combo})" : "";
|
||||
LeanTween.value(scoreText.gameObject, (float val) =>
|
||||
{
|
||||
var currentVal = Mathf.RoundToInt(val);
|
||||
|
||||
var combo = _gameSession?.ComboMultiplier ?? 1;
|
||||
var comboText = combo > 1 ? $" <color=yellow>x{combo}</color>" : "";
|
||||
|
||||
scoreText.text = $"{currentVal}{comboText}";
|
||||
}, _currentDisplayedScore, newScore, 0.5f)
|
||||
.setEaseOutExpo();
|
||||
|
||||
scoreText.text = $"Data: {newScore}{comboText}";
|
||||
_currentDisplayedScore = newScore;
|
||||
|
||||
if (highScoreText && _gameSession != null) highScoreText.text = $"BEST: {_gameSession.HighScore}";
|
||||
if (highScoreText && _gameSession != null)
|
||||
highScoreText.text = $"BEST: {_gameSession.HighScore}";
|
||||
|
||||
}
|
||||
|
||||
@@ -274,7 +289,8 @@ namespace Infrastructure.Unity
|
||||
private void StartGameSequence()
|
||||
{
|
||||
_isGameRunning = true;
|
||||
|
||||
_currentDisplayedScore = 0;
|
||||
|
||||
if (startScreenUi) startScreenUi.SetActive(false);
|
||||
|
||||
if (soundManager)
|
||||
@@ -318,12 +334,24 @@ namespace Infrastructure.Unity
|
||||
|
||||
private void OnBeatMeasure()
|
||||
{
|
||||
foreach (var tile in _allTiles)
|
||||
if (_allTiles.Count == 0) return;
|
||||
|
||||
var pulseCount = 25;
|
||||
|
||||
for (var i = 0; i < pulseCount; i++)
|
||||
{
|
||||
if (!_tileViews.TryGetValue(tile.Id, out var tileView)) continue;
|
||||
if (tile.CurrentState != TileState.Stable) continue;
|
||||
var randIndex = Random.Range(0, _allTiles.Count);
|
||||
var tile = _allTiles[randIndex];
|
||||
|
||||
tileView.PulseEmission(1.3f);
|
||||
if (tile.Floor < _currentPlayerFloorIndex) continue;
|
||||
if (tile.Floor > _currentPlayerFloorIndex + 1) continue;
|
||||
|
||||
if (tile.CurrentState != TileState.Stable) continue;
|
||||
|
||||
if (_tileViews.TryGetValue(tile.Id, out var tileView))
|
||||
{
|
||||
tileView.PulseEmission(Random.Range(1.2f, 2.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user