void PlayHandle(AudioHandle handle, AudioClip clip, float dt, Action <float> OnFinishTime = null) { if (handle.Loop) { handle.Source.clip = clip; handle.Source.loop = true; if (AudioNode.gameObject.activeSelf) { handle.Source.Play(); } } else { handle.ClipLength = clip.length; handle.FinishTime = handle.StartTime + clip.length; //handle.Source.clip = clip; handle.Source.loop = false; //handle.Source.Play(); handle.Source.PlayOneShot(clip); if (dt > 0) { handle.Source.time = dt; } } }
public StreamableAudio(string url, AudioHandle handle, bool isStream, bool autoStart) { Url = url; Handle = handle; IsStream = isStream; AutoStart = autoStart; }
public AudioHandle PlayClip(AudioClip clip, bool loops, float pitch) { AudioSource[] srcs; if (loops) { srcs = _loopingSources; } else { srcs = _sources; } AudioHandle handle = FindUnusedSourceAndPlayClip(srcs, clip, pitch); if (handle == null) { Debug.LogWarning("Unable to find source to play clip."); } return(handle); }
public bool Equals(Crane other) { if (other == null) { return(false); } return(Handle.Equals(other.Handle) && HookHandle.Equals(other.HookHandle) && AudioHandle.Equals(other.AudioHandle) && PickupX1.Equals(other.PickupX1) && PickupX2.Equals(other.PickupX2) && PickupY1.Equals(other.PickupY1) && PickupY2.Equals(other.PickupY2) && DropoffTarget.Equals(other.DropoffTarget) && DropoffHeading.Equals(other.DropoffHeading) && PickupAngle.Equals(other.PickupAngle) && DropoffAngle.Equals(other.DropoffAngle) && PickupDistance.Equals(other.PickupDistance) && DropoffDistance.Equals(other.DropoffDistance) && PickupHeight.Equals(other.PickupHeight) && DropoffHeight.Equals(other.DropoffHeight) && HookAngle.Equals(other.HookAngle) && HookDistance.Equals(other.HookDistance) && HookHeight.Equals(other.HookHeight) && HookInitialPosition.Equals(other.HookInitialPosition) && HookCurrentPosition.Equals(other.HookCurrentPosition) && HookVelocity.Equals(other.HookVelocity) && VehiclePickedUpHandle.Equals(other.VehiclePickedUpHandle) && TimeForNextCheck.Equals(other.TimeForNextCheck) && Status.Equals(other.Status) && State.Equals(other.State) && VehiclesCollected.Equals(other.VehiclesCollected) && IsCrusher.Equals(other.IsCrusher) && IsMilitaryCrane.Equals(other.IsMilitaryCrane) && WasMilitaryCrane.Equals(other.WasMilitaryCrane) && IsTop.Equals(other.IsTop)); }