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.
 
 
 
 

35 lines
910 B

using System;
using UnityEngine;
namespace UnityStandardAssets.Effects
{
public class Hose : MonoBehaviour
{
public float maxPower = 20;
public float minPower = 5;
public float changeSpeed = 5;
public ParticleSystem[] hoseWaterSystems;
public Renderer systemRenderer;
private float m_Power;
// Update is called once per frame
private void Update()
{
m_Power = Mathf.Lerp(m_Power, Input.GetMouseButton(0) ? maxPower : minPower, Time.deltaTime*changeSpeed);
if (Input.GetKeyDown(KeyCode.Alpha1))
{
systemRenderer.enabled = !systemRenderer.enabled;
}
foreach (var system in hoseWaterSystems)
{
system.startSpeed = m_Power;
system.enableEmission = (m_Power > minPower*1.1f);
}
}
}
}