File tree 5 files changed +5
-4
lines changed
5 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ GameObject:
422
422
- component : {fileID: 417150623}
423
423
- component : {fileID: 417150622}
424
424
m_Layer : 0
425
- m_Name : GameManager
425
+ m_Name : Game Manager
426
426
m_TagString : Untagged
427
427
m_Icon : {fileID: 0}
428
428
m_NavMeshLayer : 0
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public enum ForceType
14
14
15
15
private void OnCollisionEnter2D ( Collision2D collision )
16
16
{
17
- if ( collision . gameObject . TryGetComponent < Ball > ( out var ball ) )
17
+ if ( collision . gameObject . TryGetComponent ( out Ball ball ) )
18
18
{
19
19
switch ( forceType )
20
20
{
Original file line number Diff line number Diff line change 1
1
using UnityEngine ;
2
2
using UnityEngine . UI ;
3
3
4
+ [ DefaultExecutionOrder ( - 1 ) ]
4
5
public class GameManager : MonoBehaviour
5
6
{
6
7
[ SerializeField ] private Ball ball ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ private void OnCollisionEnter2D(Collision2D collision)
36
36
// Rotate the direction of the ball based on the contact distance
37
37
// to make the gameplay more dynamic and interesting
38
38
float maxBounceAngle = 75f ;
39
- float bounceAngle = ( contactDistance . y / paddle . bounds . size . y ) * maxBounceAngle ;
39
+ float bounceAngle = contactDistance . y / paddle . bounds . size . y * maxBounceAngle ;
40
40
ballDirection = Quaternion . AngleAxis ( bounceAngle , rotationAxis ) * ballDirection ;
41
41
42
42
// Re-apply the new direction to the ball
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public class ScoringZone : MonoBehaviour
8
8
9
9
private void OnCollisionEnter2D ( Collision2D collision )
10
10
{
11
- if ( collision . gameObject . TryGetComponent < Ball > ( out var ball ) ) {
11
+ if ( collision . gameObject . TryGetComponent ( out Ball _ ) ) {
12
12
scoreTrigger . Invoke ( ) ;
13
13
}
14
14
}
You can’t perform that action at this time.
0 commit comments