123456789101112131415161718192021222324252627282930313233 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using UnityEngine;
- public class Ball : MonoBehaviour
- {
- public float speed = 5f;
- // Start is called before the first frame update
- void Start()
- {
- //Thread.Sleep(5000);
- //float sx = Random.Range(0, 2) == 0 ? -1 : 1;
- //float sz = Random.Range(0, 2) == 0 ? -1 : 1;
- //GetComponent<Rigidbody>().velocity = new Vector3(speed * sx, 0f, speed * sz);
- }
- public void Init()
- {
- float sx = Random.Range(0, 2) == 0 ? -1 : 1;
- float sz = Random.Range(0, 2) == 0 ? -1 : 1;
- GetComponent<Rigidbody>().velocity = new Vector3(speed * sx, 0f, speed * sz);
- }
- // Update is called once per frame
- void Update()
- {
-
- }
- }
|