TerrainTimeline.cs 895 B

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. namespace Chronos
  3. {
  4. public class TerrainTimeline : ComponentTimeline<Terrain>
  5. {
  6. private float _wavingGrassSpeed;
  7. /// <summary>
  8. /// The pitch that is applied to the audio source before time effects. Use this property instead of AudioSource.pitch, which will be overwritten by the timeline at runtime.
  9. /// </summary>
  10. public float wavingGrassSpeed
  11. {
  12. get { return _wavingGrassSpeed; }
  13. set
  14. {
  15. _wavingGrassSpeed = value;
  16. AdjustProperties();
  17. }
  18. }
  19. public TerrainTimeline(Timeline timeline, Terrain component) : base(timeline, component) { }
  20. public override void CopyProperties(Terrain source)
  21. {
  22. _wavingGrassSpeed = source.terrainData.wavingGrassSpeed;
  23. }
  24. public override void AdjustProperties(float timeScale)
  25. {
  26. // Currently bugged in Unity
  27. // component.terrainData.wavingGrassSpeed = wavingGrassSpeed * timeScale;
  28. }
  29. }
  30. }