using System; using Unity.Netcode; using UnityEngine; namespace Game { public class Ball : NetworkBehaviour { public Rigidbody2D Rb { get; private set; } private CircleCollider2D Collider { get; set; } public float Radius { get => transform.localScale.x * Collider.radius; set => transform.localScale = new Vector3(1, 1, 1) * value * 2; } public bool IsAlive { get { float y = transform.position.y; float y1 = BorderSize.Singleton.y1; float y2 = BorderSize.Singleton.y2; return y > y1 && y < y2; } } private void OnEnable() { Rb = GetComponent(); Collider = GetComponent(); } private void Start() { Rb.velocity = new Vector2(0, 25); } } }