25 lines
688 B
25 lines
688 B
1 year ago
|
using System.Collections.Generic;
|
||
|
using UniRx;
|
||
|
using UnityEngine;
|
||
|
public class HoseController : MonoBehaviour
|
||
|
{
|
||
|
public float maxPower = 50;
|
||
|
public float minPower = 5;
|
||
|
public float speed = 3;
|
||
|
public List<ParticleSystem> HoseSyetem = new List<ParticleSystem>();
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
Observable.EveryLateUpdate()
|
||
|
.Subscribe(_ =>
|
||
|
{
|
||
|
foreach (var system in HoseSyetem)
|
||
|
{
|
||
|
ParticleSystem.MainModule mainModule = system.main;
|
||
|
mainModule.startSpeed = Mathf.Clamp(minPower * speed, minPower, maxPower);
|
||
|
|
||
|
}
|
||
|
}).AddTo(gameObject);
|
||
|
}
|
||
|
}
|