Adjust player and jump pad physics parameters; refine visual effects and project settings

This commit is contained in:
2025-12-13 15:57:15 +01:00
parent 0d0c92fc83
commit 3a56ec7526
10 changed files with 205 additions and 215 deletions

File diff suppressed because one or more lines are too long

View File

@@ -128,7 +128,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5de94b384aac49a7baa41967735126b0, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.JumpPadAdapter
jumpForce: 26
jumpForce: 30
jumpVfx: {fileID: 6513758771719240250}
--- !u!1001 &7177263622647527747
PrefabInstance:

View File

@@ -158,7 +158,10 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.PlayerController
moveSpeed: 8
maxVelocityChange: 10
snapForce: 15
snapForce: 3
jumpForce: 12
coyoteTime: 0.1
gravityMultiplier: 2.5
useCameraRelativeMovement: 0
tileLayer:
serializedVersion: 2

View File

@@ -611,7 +611,7 @@ ParticleSystem:
gravityModifier:
serializedVersion: 2
minMaxState: 0
scalar: 5
scalar: -0.5
minScalar: 0
maxCurve:
serializedVersion: 2

View File

@@ -674,7 +674,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.LevelGenerator
tilePrefab: {fileID: 2142595510769725438, guid: a84ad84e96942d35c824885a7c08a844, type: 3}
tileBreakVfxPrefab: {fileID: 0}
tileBreakVfxPrefab: {fileID: 3395603910160708684, guid: 7c5c893ba21562b2aad6bffb1887f4b1, type: 3}
jumpPadPrefab: {fileID: 3258547662887829175, guid: e1d1bd44370c9986ebd4bb7730430a12, type: 3}
teleporterPrefab: {fileID: 4601941687390792571, guid: 53f1de555c523511e9aaa1dee06fdf79, type: 3}
gridSizeX: 25

View File

@@ -45,6 +45,7 @@ namespace Infrastructure.Unity
private bool _isGameRunning;
private int _currentPlayerFloorIndex;
private int _currentDisplayedScore;
private float _inputBlockTimer;
private void OnEnable()
{
@@ -61,6 +62,7 @@ namespace Infrastructure.Unity
private void Start()
{
_inputBlockTimer = 0.5f;
_persistenceService = new PlayerPrefsPersistenceAdapter();
_gameSession = new GameSession(_allTiles, _persistenceService);
@@ -98,6 +100,12 @@ namespace Infrastructure.Unity
private void Update()
{
if (_inputBlockTimer > 0f)
{
_inputBlockTimer -= Time.deltaTime;
return;
}
if (!_isGameRunning)
{
if (_actions.Player.StartGame.triggered)

View File

@@ -10,15 +10,7 @@ namespace Infrastructure.Unity
[Self][SerializeField] private MeshRenderer meshRenderer;
public event Action OnCollected;
private MaterialPropertyBlock _propBlock;
private static readonly int ColorProperty = Shader.PropertyToID("_BaseColor");
private void Awake()
{
_propBlock = new MaterialPropertyBlock();
}
private void OnTriggerEnter(Collider other)
{
if (other.TryGetComponent<PlayerController>(out var player))
@@ -28,8 +20,7 @@ namespace Infrastructure.Unity
var vfx = Instantiate(pickupVfx, transform.position, Quaternion.identity);
var main = vfx.main;
meshRenderer.GetPropertyBlock(_propBlock);
var currentColor = _propBlock.GetColor(ColorProperty);
var currentColor = meshRenderer.material.color;
main.startColor = currentColor;
Destroy(vfx.gameObject, 2f);

View File

@@ -43,6 +43,7 @@ namespace Infrastructure.Unity
private bool _isGrounded;
private float _coyoteTimeCounter;
private bool _jumpPressed;
private Vector3 _currentTileCentroid;
public Rigidbody Rigidbody => rb;
public StatusManager Status { get; private set; }
@@ -125,7 +126,15 @@ namespace Infrastructure.Unity
private void CheckGround()
{
_isGrounded = Physics.Raycast(transform.position, Vector3.down, groundCheckDistance, tileLayer);
if (Physics.SphereCast(transform.position, 0.3f, Vector3.down, out var hit, groundCheckDistance, tileLayer))
{
_isGrounded = true;
_currentTileCentroid = hit.collider.transform.position;
}
else
{
_isGrounded = false;
}
}
private void PerformJump()
@@ -213,18 +222,25 @@ namespace Infrastructure.Unity
private void ApplySnapping(Vector3 axis)
{
if (!_isGrounded) return;
var targetPos = Vector3.Dot(_currentTileCentroid, axis);
var currentPos = Vector3.Dot(transform.position, axis);
var targetPos = Mathf.Round(currentPos);
var diff = targetPos - currentPos;
var correction = axis * (diff * snapForce);
rb.AddForce(correction, ForceMode.Acceleration);
var currentVelOnAxis = Vector3.Dot(rb.linearVelocity, axis);
var targetVel = diff * snapForce;
var correction = axis * (targetVel - currentVelOnAxis);
rb.AddForce(correction, ForceMode.VelocityChange);
}
private void InteractWithGround()
{
if (Physics.Raycast(transform.position, Vector3.down, out var hit, groundCheckDistance, tileLayer))
if (Physics.SphereCast(transform.position, 0.3f, Vector3.down, out var hit, groundCheckDistance, tileLayer))
{
if (hit.collider.TryGetComponent<TileViewAdapter>(out var tileAdapter))
{

View File

@@ -169,7 +169,7 @@ namespace Infrastructure.Unity
{
var t = 0f;
var startScale = transform.localScale;
while (t < 1f)
while (t < 0.4f)
{
t += Time.deltaTime;
transform.localScale = Vector3.Lerp(startScale, Vector3.zero, t);