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_Script: {fileID: 11500000, guid: 5de94b384aac49a7baa41967735126b0, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.JumpPadAdapter m_EditorClassIdentifier: Assembly-CSharp::Infrastructure.Unity.JumpPadAdapter
jumpForce: 26 jumpForce: 30
jumpVfx: {fileID: 6513758771719240250} jumpVfx: {fileID: 6513758771719240250}
--- !u!1001 &7177263622647527747 --- !u!1001 &7177263622647527747
PrefabInstance: PrefabInstance:

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,14 +11,6 @@ namespace Infrastructure.Unity
public event Action OnCollected; 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) private void OnTriggerEnter(Collider other)
{ {
if (other.TryGetComponent<PlayerController>(out var player)) if (other.TryGetComponent<PlayerController>(out var player))
@@ -28,8 +20,7 @@ namespace Infrastructure.Unity
var vfx = Instantiate(pickupVfx, transform.position, Quaternion.identity); var vfx = Instantiate(pickupVfx, transform.position, Quaternion.identity);
var main = vfx.main; var main = vfx.main;
meshRenderer.GetPropertyBlock(_propBlock); var currentColor = meshRenderer.material.color;
var currentColor = _propBlock.GetColor(ColorProperty);
main.startColor = currentColor; main.startColor = currentColor;
Destroy(vfx.gameObject, 2f); Destroy(vfx.gameObject, 2f);

View File

@@ -43,6 +43,7 @@ namespace Infrastructure.Unity
private bool _isGrounded; private bool _isGrounded;
private float _coyoteTimeCounter; private float _coyoteTimeCounter;
private bool _jumpPressed; private bool _jumpPressed;
private Vector3 _currentTileCentroid;
public Rigidbody Rigidbody => rb; public Rigidbody Rigidbody => rb;
public StatusManager Status { get; private set; } public StatusManager Status { get; private set; }
@@ -125,7 +126,15 @@ namespace Infrastructure.Unity
private void CheckGround() 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() private void PerformJump()
@@ -213,18 +222,25 @@ namespace Infrastructure.Unity
private void ApplySnapping(Vector3 axis) private void ApplySnapping(Vector3 axis)
{ {
if (!_isGrounded) return;
var targetPos = Vector3.Dot(_currentTileCentroid, axis);
var currentPos = Vector3.Dot(transform.position, axis); var currentPos = Vector3.Dot(transform.position, axis);
var targetPos = Mathf.Round(currentPos);
var diff = targetPos - 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() 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)) if (hit.collider.TryGetComponent<TileViewAdapter>(out var tileAdapter))
{ {

View File

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

View File

@@ -12,7 +12,7 @@ PlayerSettings:
targetDevice: 2 targetDevice: 2
useOnDemandResources: 0 useOnDemandResources: 0
accelerometerFrequency: 60 accelerometerFrequency: 60
companyName: DefaultCompany companyName: Gabriel Kaszewski
productName: Decay Grid productName: Decay Grid
defaultCursor: {fileID: 0} defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0} cursorHotspot: {x: 0, y: 0}
@@ -143,7 +143,7 @@ PlayerSettings:
loadStoreDebugModeEnabled: 0 loadStoreDebugModeEnabled: 0
visionOSBundleVersion: 1.0 visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0 tvOSBundleVersion: 1.0
bundleVersion: 0.1.0 bundleVersion: 1.0
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0