private void StartSample() { ResolvedGrain resolvedGrain = this.subDef.RandomizedResolvedGrain(); if (resolvedGrain == null) { Log.Error("SubSustainer for " + this.subDef + " of " + this.parent.def + " could not resolve any grains."); this.parent.End(); } else { float num = (!this.subDef.sustainLoop) ? resolvedGrain.duration : this.subDef.sustainLoopDurationRange.RandomInRange; float num2 = Time.realtimeSinceStartup + num; this.nextSampleStartTime = num2 + this.subDef.sustainIntervalRange.RandomInRange; if (this.nextSampleStartTime < Time.realtimeSinceStartup + 0.0099999997764825821) { this.nextSampleStartTime = (float)(Time.realtimeSinceStartup + 0.0099999997764825821); } if (!(resolvedGrain is ResolvedGrain_Silence)) { SampleSustainer sampleSustainer = SampleSustainer.TryMakeAndPlay(this, ((ResolvedGrain_Clip)resolvedGrain).clip, num2); if (sampleSustainer != null) { if (this.subDef.sustainSkipFirstAttack && Time.frameCount == this.creationFrame) { sampleSustainer.resolvedSkipAttack = true; } this.samples.Add(sampleSustainer); } } } }
private void StartSample() { ResolvedGrain resolvedGrain = subDef.RandomizedResolvedGrain(); if (resolvedGrain == null) { Log.Error(string.Concat("SubSustainer for ", subDef, " of ", parent.def, " could not resolve any grains.")); parent.End(); return; } float num = ((!subDef.sustainLoop) ? resolvedGrain.duration : subDef.sustainLoopDurationRange.RandomInRange); float num2 = Time.realtimeSinceStartup + num; nextSampleStartTime = num2 + subDef.sustainIntervalRange.RandomInRange; if (nextSampleStartTime < Time.realtimeSinceStartup + 0.01f) { nextSampleStartTime = Time.realtimeSinceStartup + 0.01f; } if (resolvedGrain is ResolvedGrain_Silence) { return; } SampleSustainer sampleSustainer = SampleSustainer.TryMakeAndPlay(this, ((ResolvedGrain_Clip)resolvedGrain).clip, num2); if (sampleSustainer != null) { if (subDef.sustainSkipFirstAttack && Time.frameCount == creationFrame) { sampleSustainer.resolvedSkipAttack = true; } samples.Add(sampleSustainer); } }
private void StartSample() { ResolvedGrain resolvedGrain = this.subDef.RandomizedResolvedGrain(); if (resolvedGrain == null) { Log.Error(string.Concat(new object[] { "SubSustainer for ", this.subDef, " of ", this.parent.def, " could not resolve any grains." })); this.parent.End(); return; } float num; if (this.subDef.sustainLoop) { num = this.subDef.sustainLoopDurationRange.RandomInRange; } else { num = resolvedGrain.duration; } float num2 = Time.realtimeSinceStartup + num; this.nextSampleStartTime = num2 + this.subDef.sustainIntervalRange.RandomInRange; if (this.nextSampleStartTime < Time.realtimeSinceStartup + 0.01f) { this.nextSampleStartTime = Time.realtimeSinceStartup + 0.01f; } if (resolvedGrain is ResolvedGrain_Silence) { return; } SampleSustainer sampleSustainer = SampleSustainer.TryMakeAndPlay(this, ((ResolvedGrain_Clip)resolvedGrain).clip, num2); if (sampleSustainer == null) { return; } if (this.subDef.sustainSkipFirstAttack && Time.frameCount == this.creationFrame) { sampleSustainer.resolvedSkipAttack = true; } this.samples.Add(sampleSustainer); }