using System.Collections; using System.Collections.Generic; using System.Threading; using UnityEngine; public class Ball : MonoBehaviour { public bool IsInUse { get; private set; } public float speed = 5f; // Start is called before the first frame update void Start() { } public void Recenter() { var component = GetComponent(); component.velocity = Vector3.zero; component.transform.position = Vector3.zero; IsInUse = false; } public void Kickoff() { float sx = Random.Range(0, 2) == 0 ? -1 : 1; float sz = Random.Range(0, 2) == 0 ? -1 : 1; GetComponent().velocity = new Vector3(speed * sx, 0f, speed * sz); IsInUse = true; } // Update is called once per frame void Update() { } }