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