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.
25 lines
688 B
25 lines
688 B
11 months 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);
|
||
|
}
|
||
|
}
|