asset integration 50%

This commit is contained in:
2026-03-29 02:27:55 +05:30
parent 3108262326
commit b8ce9120d5
1691 changed files with 1192616 additions and 262 deletions
+23
View File
@@ -65,6 +65,13 @@ public class Puck : NetworkBehaviour
float clamp = GameManager.instance.puckDragClampMax;
lineEnd = Vector2.ClampMagnitude(lineEnd, clamp);
if (NetPlayer.localPlayer != null
&& team == NetPlayer.localPlayer.myTeam
&& GameManager.instance.SelectedTeam == team)
{
CameraEffects.instance.SetStretchFactor(lineEnd.magnitude / clamp);
}
// Only two points for the line
lineRenderer.positionCount = 2;
lineRenderer.SetPosition(0, Vector3.zero);
@@ -111,6 +118,22 @@ public class Puck : NetworkBehaviour
}
void OnCollisionEnter2D(Collision2D collision)
{
if (!collision.collider.CompareTag("Puck"))
return;
// Both pucks get this callback; play once per contact.
if (gameObject.GetInstanceID() >= collision.gameObject.GetInstanceID())
return;
float otherSpeed = collision.relativeVelocity.magnitude;
Debug.Log("Puck collision speed: " + otherSpeed);
float maxVolSpeed =5f;
float vol = Mathf.Clamp(otherSpeed / maxVolSpeed,0.1f,1);
if (AudioManager.instance != null)
AudioManager.instance.PlayPuckHit(vol);
}
public void Reset(Vector3? position = null, float duration = 0.5f)
{
Vector3 pos = position ?? startPosition;