Skip to content

Commit e2d15e0

Browse files
committed
Code cleanup and formatting changes
1 parent c130259 commit e2d15e0

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

Assets/Scenes/Pong.unity

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ GameObject:
422422
- component: {fileID: 417150623}
423423
- component: {fileID: 417150622}
424424
m_Layer: 0
425-
m_Name: GameManager
425+
m_Name: Game Manager
426426
m_TagString: Untagged
427427
m_Icon: {fileID: 0}
428428
m_NavMeshLayer: 0

Assets/Scripts/BouncySurface.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public enum ForceType
1414

1515
private void OnCollisionEnter2D(Collision2D collision)
1616
{
17-
if (collision.gameObject.TryGetComponent<Ball>(out var ball))
17+
if (collision.gameObject.TryGetComponent(out Ball ball))
1818
{
1919
switch (forceType)
2020
{

Assets/Scripts/GameManager.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using UnityEngine;
22
using UnityEngine.UI;
33

4+
[DefaultExecutionOrder(-1)]
45
public class GameManager : MonoBehaviour
56
{
67
[SerializeField] private Ball ball;

Assets/Scripts/Paddle.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private void OnCollisionEnter2D(Collision2D collision)
3636
// Rotate the direction of the ball based on the contact distance
3737
// to make the gameplay more dynamic and interesting
3838
float maxBounceAngle = 75f;
39-
float bounceAngle = (contactDistance.y / paddle.bounds.size.y) * maxBounceAngle;
39+
float bounceAngle = contactDistance.y / paddle.bounds.size.y * maxBounceAngle;
4040
ballDirection = Quaternion.AngleAxis(bounceAngle, rotationAxis) * ballDirection;
4141

4242
// Re-apply the new direction to the ball

Assets/Scripts/ScoringZone.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class ScoringZone : MonoBehaviour
88

99
private void OnCollisionEnter2D(Collision2D collision)
1010
{
11-
if (collision.gameObject.TryGetComponent<Ball>(out var ball)) {
11+
if (collision.gameObject.TryGetComponent(out Ball _)) {
1212
scoreTrigger.Invoke();
1313
}
1414
}

0 commit comments

Comments
 (0)