Slider3D.cs 872 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace SC {
  5. public class Slider3D : PointEffectBase
  6. {
  7. public float value = 0;
  8. public Transform frontGround;
  9. public Transform backGround;
  10. private float initfrontScale;
  11. private float initbackScale;
  12. protected override void Awake() {
  13. base.Awake();
  14. initbackScale = backGround.localScale.z;
  15. initfrontScale = frontGround.localScale.z;
  16. }
  17. protected override void Update() {
  18. base.Update();
  19. if (value <= 0) {
  20. value = 0;
  21. } else if (value >= 1) {
  22. value = 1;
  23. }
  24. frontGround.localScale = new Vector3(frontGround.localScale.x, frontGround.localScale.y,value * initbackScale);
  25. }
  26. }
  27. }