Ejemplo n.º 1
0
            void OnCollisionEnter(Collision collision)
            {
                Vector3 force = (Vector3.forward + Vector3.up + Random.insideUnitSphere).normalized * Random.Range(100, 150);

                collision.rigidbody.AddForce(force, ForceMode.Impulse);

                Runner_Car car = collision.gameObject.GetComponent <Runner_Car>();

                if (car != null)
                {
                    car.speed = 1;
                }
            }
Ejemplo n.º 2
0
            public void DestroyCar(Runner_Car car)
            {
                GameObject.Destroy(car.gameObject);

                Instantiate(cars[Random.Range(0, cars.Length)]);
            }