Seven is the number.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1013 B

  1. using System;
  2. using UnityEngine;
  3. namespace UnityStandardAssets.Effects
  4. {
  5. public class Hose : MonoBehaviour
  6. {
  7. public float maxPower = 20;
  8. public float minPower = 5;
  9. public float changeSpeed = 5;
  10. public ParticleSystem[] hoseWaterSystems;
  11. public Renderer systemRenderer;
  12. private float m_Power;
  13. // Update is called once per frame
  14. private void Update()
  15. {
  16. m_Power = Mathf.Lerp(m_Power, Input.GetMouseButton(0) ? maxPower : minPower, Time.deltaTime*changeSpeed);
  17. if (Input.GetKeyDown(KeyCode.Alpha1))
  18. {
  19. systemRenderer.enabled = !systemRenderer.enabled;
  20. }
  21. foreach (var system in hoseWaterSystems)
  22. {
  23. ParticleSystem.MainModule mainModule = system.main;
  24. mainModule.startSpeed = m_Power;
  25. var emission = system.emission;
  26. emission.enabled = (m_Power > minPower*1.1f);
  27. }
  28. }
  29. }
  30. }