sounds and screens with improved matchmaker
This commit is contained in:
+18
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user