// Use this for initialization void Start() { if (target == null) { target = Object.FindObjectOfType <PlayerMouseController>().transform; } slider = GetComponent <SphereSurfaceSlider>(); }
public void HitStorm(Puck puck) { SphereSurfaceSlider otherSlider = puck.GetComponent <SphereSurfaceSlider>(); if (otherSlider && puck) { otherSlider.HitByStormWithSphericalVelocity(0.5f * slider.sphericalVelocity); GameObject.Destroy(gameObject); } }
void OnCollisionEnter(Collision collision) { Puck puck = collision.collider.GetComponent <Puck>(); SphereSurfaceSlider otherSlider = collision.collider.GetComponent <SphereSurfaceSlider>(); if (otherSlider && puck) { otherSlider.HitByStormWithSphericalVelocity(slider.sphericalVelocity); GameObject.Destroy(gameObject); } }
void SpawnWorldObj(GameObject prefab, float minSpeed, float maxSpeed) { // Choose a random location Vector3 spawnLocation = Random.onUnitSphere; Vector3 rightAngleVector = spawnLocation == Vector3.up ? Vector3.right : Vector3.up; Vector3 movementDirection = Vector3.Cross(spawnLocation, rightAngleVector); Vector3 movementVector = Quaternion.AngleAxis(Random.Range(0f, 360f), spawnLocation) * movementDirection; GameObject spawnedObject = (GameObject)GameObject.Instantiate(prefab, spawnLocation * 50f, Quaternion.LookRotation(movementDirection, spawnLocation)); SphereSurfaceSlider slider = spawnedObject.GetComponent <SphereSurfaceSlider>(); slider.sphericalVelocity = Random.Range(minSpeed, maxSpeed) * movementVector; }
// Use this for initialization void Start() { slider = GetComponent <SphereSurfaceSlider>(); turnRateChangeCyclePosition = Random.value; }
// Use this for initialization void Start() { slider = GetComponent <SphereSurfaceSlider>(); }