52 lines
1.3 KiB
C#

using ScarletMansion.GamePatch.Components;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Unity.Netcode;
using UnityEngine;
namespace ScarletMansion {
public class ScarletVent : EnemyVent {
[Header("References")]
public ScarletVentVisuals visuals;
public EnemyType ignoreEnemyType;
void Awake(){
ignoreEnemyType = Assets.knight.enemyType;
}
public void ScarletUpdate(){
if (occupied && enemyType != ignoreEnemyType){
var startTime = spawnTime - roundManager.timeScript.currentDayTime;
if (isPlayingAudio) {
var lerp = Mathf.Abs(startTime / enemyType.timeToPlayAudio - 1f);
visuals.SetVolumeLazy(lerp);
lowPassFilter.lowpassResonanceQ = Math.Abs(lerp * 2f - 2f);
return;
}
if (startTime < enemyType.timeToPlayAudio) {
isPlayingAudio = true;
visuals.StartSpawnParticles();
return;
}
} else if (isPlayingAudio) {
isPlayingAudio = false;
visuals.StopSpawnParticles();
visuals.StopLightningParticles();
}
}
public void OpenVent(){
ScarletNetworkManager.Instance.CreateSpawnAudioPrefabLocal(transform.position);
}
}
}