void FixedUpdate() { RaycastHit hit; if (warningInstance == null && Physics.Raycast (transform.position, transform.forward, out hit, kWarningDistance, warningBase)) // If we haven't detected impact yet and we now do, spawn an impact warning and store its reference { warningInstance = demoControl.SpawnWarning (hit.point, Quaternion.identity); } }
void FixedUpdate() { RaycastHit hit; if (warningInstance == null && Physics.Raycast(transform.position, transform.forward, out hit, kWarningDistance, warningBase)) // If we haven't detected impact yet and we now do, spawn an impact warning and store its reference { warningInstance = demoControl.SpawnWarning(hit.point, Quaternion.identity); } }
// Disable the given impact warning and move it back into the object pool public void DespawnWarning(ImpactWarning warning) { if (warning == null) { return; } warning.gameObject.SetActiveRecursively (false); warningPool.Enqueue (warning); }
public void DespawnWarning(ImpactWarning warning) // Disable the given impact warning and move it back into the object pool { if (warning == null) { return; } warning.gameObject.SetActiveRecursively(false); warningPool.Enqueue(warning); }
public ImpactWarning SpawnWarning(Vector3 position, Quaternion rotation) // Grab an impact warning from the object pool and activate it with the given position and rotation { if (warningPool.Count < 1) { return(null); } ImpactWarning warning = warningPool.Dequeue(); warning.transform.position = position; warning.transform.rotation = rotation; warning.gameObject.SetActiveRecursively(true); return(warning); }
void OnDisable() { warningInstance = null; emitter.ClearParticles(); }
void OnDisable() { warningInstance = null; emitter.ClearParticles (); }