public void playScheduled(YoumuSlashSoundEffect soundEffect, YoumuSlashBeatMap.TargetBeat.Direction direction, float time) { foreach (var sound in soundEffect.Sounds) { var newSource = Instantiate(audioSourcePrefab, transform); newSource.pitch = MathHelper.randomRangeFromVector(sound.PitchRange) * timeScale; newSource.panStereo = getStereoPan(sound.PanAmount, direction); if (sound.PanSpeed != 0f) { newSource.GetComponent <YoumuSlashMovingAudioSource>().setSpeed(sound.PanSpeed * (direction == YoumuSlashBeatMap.TargetBeat.Direction.Left ? -1f : 1f)); } newSource.clip = sound.Clip; if (time <= 0f) { newSource.Play(); } else { AudioHelper.playScheduled(newSource, time); } } }
void importTargetTypeTraits(YoumuSlashBeatMap.TargetBeat target) { body.RigAnimator.runtimeAnimatorController = target.TypeData.Animator; body.BaseImage.sprite = target.TypeData.Image; launchSoundEffect = target.TypeData.LaunchSoundEffect; }
public void play(YoumuSlashSoundEffect soundEffect, YoumuSlashBeatMap.TargetBeat.Direction direction) => playScheduled(soundEffect, direction, 0f);