sounds and screens with improved matchmaker

This commit is contained in:
2026-04-05 00:08:52 +05:30
parent ef89a7320a
commit 352693c860
38 changed files with 6044 additions and 2270 deletions
+18 -2
View File
@@ -1,7 +1,8 @@
using System.Collections;
using Mirror;
using UnityEngine;
public class Ball : MonoBehaviour
public class Ball : NetworkBehaviour
{
[HideInInspector]public Rigidbody2D rb;
Vector3 startPosition;
@@ -35,8 +36,10 @@ public class Ball : MonoBehaviour
public bool touchingB,touchingL,touchingR,touchingT = false;
void Update()
{
WallDetection();
CheckNearGoal();
if(!isServer){return;}
WallDetection();
}
@@ -50,6 +53,7 @@ public class Ball : MonoBehaviour
}
}
distToGoal = closestDist;
AudioManager.instance.SetIsBallNearGoal(distToGoal < nearGoalThreshold);
}
@@ -92,13 +96,25 @@ public class Ball : MonoBehaviour
if(collision.collider.CompareTag("wall")){
AudioManager.instance.PlayWallHit(vol);
RpcWallHitAudio(vol);
}
else if(collision.collider.CompareTag("Puck")){
AudioManager.instance.PlayBallHit(vol);
RpcBallHitAudio(vol);
}
}
[ClientRpc]
void RpcWallHitAudio(float vol){
AudioManager.instance.PlayWallHit(vol);
}
[ClientRpc]
void RpcBallHitAudio(float vol){
AudioManager.instance.PlayBallHit(vol);
}
void WallDetection(){
// Linecast for each direction
Vector3 pos = transform.position;