TweakCondomDispenserValues.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using UnityEngine;
  2. using System.Collections;
  3. public class TweakCondomDispenserValues : MonoBehaviour {
  4. CondomDispenser condomDispenser;
  5. bool isTweaking;
  6. void Start()
  7. {
  8. condomDispenser = GetComponent<CondomDispenser>();
  9. DebugViewManager.OnDebugView += OnDebugView;
  10. }
  11. void OnDestroy()
  12. {
  13. DebugViewManager.OnDebugView -= OnDebugView;
  14. }
  15. static void ShowFloatSlider(string label, ref float output, float min, float max)
  16. {
  17. GUILayout.Label(label+" "+output);
  18. output = GUILayout.HorizontalSlider(output, min, max, null);
  19. }
  20. static void ShowIntSlider(string label, ref int output, int min, int max)
  21. {
  22. GUILayout.Label(label+" "+output);
  23. output = (int)GUILayout.HorizontalSlider(output, min, max, null);
  24. }
  25. void OnDebugView()
  26. {
  27. if (GUILayout.Button("Tweak"))
  28. {
  29. isTweaking = !isTweaking;
  30. }
  31. if (isTweaking)
  32. {
  33. ShowFloatSlider("Move Speed", ref condomDispenser.moveSpeed, 500, 10000);
  34. ShowFloatSlider("Recoil Offset", ref condomDispenser.recoilOffset, 0, 20);
  35. ShowFloatSlider("Recoil Time Out", ref condomDispenser.recoilTimeOut, 0, 0.5f);
  36. ShowFloatSlider("Recoil Time In", ref condomDispenser.recoilTimeIn, 0, 0.5f);
  37. ShowIntSlider("Max Queue (0 = infinite)", ref condomDispenser.maxQueuedTaps, 0, 10);
  38. }
  39. }
  40. }