ccl4/blueberryPeak/Assets/Scripts/Wind.cs
2025-06-16 16:41:07 +02:00

57 lines
1.3 KiB
C#

using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
public class Wind : MonoBehaviour
{
private GameObject Player;
[SerializeField] float windSpeedStep = 0.1f;
[SerializeField] float initWindSpeed;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
AkSoundEngine.SetRTPCValue("WindSpeed", initWindSpeed);
}
// Update is called once per frame
void Update()
{
}
Coroutine currentCoroutine;
private void OnTriggerEnter(Collider other)
{
print("gnuisd "+other.tag);
if (other.tag == "fastWind")
{
ChangeWindSpeed(90);
Debug.Log("fast");
}
if (other.tag == "slowWind")
{
ChangeWindSpeed(20);
Debug.Log("slow");
}
if (other.tag == "midWind")
{
ChangeWindSpeed(55);
Debug.Log("mid");
}
}
private float currentWindSpeed;
IEnumerator ChangeWindSpeed(float val)
{
while (currentWindSpeed != val)
{
AkSoundEngine.SetRTPCValue("WindSpeed", currentWindSpeed+windSpeedStep);
yield return null;
}
}
}