public override void Play(EffectContext context) { var position = context.GetRequiredFeature <PositionFeature>().Position; var clip = Clips.RandomElement(); AudioSource.PlayClipAtPoint(clip, position, Volume); }
public override void Play(EffectContext context) { var position = context.GetRequiredFeature <PositionFeature>().Position; // Check if color features are present var color = context.GetOptionalFeature <ColorFeature>(); var gradient = context.GetOptionalFeature <GradientFeature>(); var minMaxColor = context.GetOptionalFeature <MinMaxColorFeature>(); var minMaxGradient = context.GetOptionalFeature <MinMaxGradientFeature>(); // If more than one are provided, this.CheckIncompatibleFeatures(color, gradient, minMaxColor, minMaxGradient); var instance = ParticlePrefab.Clone(position); if (color != null) { SetParticleColor(instance, color.Color); } if (gradient != null) { SetParticleColor(instance, gradient.Gradient); } if (minMaxColor != null) { SetParticleColor(instance, minMaxColor); } if (minMaxGradient != null) { SetParticleColor(instance, minMaxGradient); } var material = context.GetOptionalFeature <MaterialFeature>(); if (material != null) { var renderer = instance.GetComponent <ParticleSystemRenderer>(); renderer.sharedMaterial = material.Material; } OnDefaultSetupFinished(instance, context); if (!ForceDestroyOnFinished) { return; } var main = instance.main; main.stopAction = ParticleSystemStopAction.Destroy; if (!main.playOnAwake) { instance.Play(); } }
public override void Play(EffectContext context) { var controller = context.GetRequiredFeature <ObjectFeature <FOVController> >().Value; FOVMeta meta; switch (Mode) { case ValueControlMode.Constant: meta = new ConstantFOVMeta(ConstantFOV); break; case ValueControlMode.Animated: meta = new AnimatedFOVMeta(AnimatedFOV); break; default: throw new ArgumentOutOfRangeException(); } controller.RegisterTimedService(Duration, meta, priority: ServicePriority); }