Added the new coilhead behaviour to the knight Added treasure room puzzle for bedroom Changed many LogInfo into LogDebug Removed jank animator override stuff (no offense) Changed how treasure rooms lock their doors to work in multiplayer Removed basement scripts
68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace ScarletMansion {
|
|
public class ScarletVent : MonoBehaviour {
|
|
|
|
public AudioSource shakeAudioSource;
|
|
public AudioSource summonAudioSource;
|
|
public PlayAudioAnimationEvent audioEvent;
|
|
|
|
[Header("Shake")]
|
|
public ParticleSystem spawningPartciles;
|
|
public ParticleSystem lightingParticles;
|
|
public ParticleSystem emitParticles;
|
|
public float volumeToRate = 1f;
|
|
|
|
public static bool prewarm;
|
|
|
|
void Start(){
|
|
if (!prewarm){
|
|
OpenVentClientRpc();
|
|
prewarm = true;
|
|
Plugin.logger.LogDebug("Prewarming particles by forcing it emit now lmao");
|
|
}
|
|
}
|
|
|
|
private void PlayParticleSystem(ParticleSystem ps){
|
|
if (ps.isPlaying) return;
|
|
ps.Play();
|
|
}
|
|
|
|
private void StopParticleSystem(ParticleSystem ps){
|
|
if (!ps.isPlaying) return;
|
|
ps.Stop();
|
|
}
|
|
|
|
public void OpenVentClientRpc(){
|
|
emitParticles.Play();
|
|
audioEvent.PlayAudio1Oneshot();
|
|
}
|
|
|
|
void Update(){
|
|
var isPlaying = shakeAudioSource.isPlaying;
|
|
if (isPlaying){
|
|
PlayParticleSystem(spawningPartciles);
|
|
SetEmissionRate(spawningPartciles, shakeAudioSource.volume * volumeToRate);
|
|
|
|
if (shakeAudioSource.volume >= 0.8f) PlayParticleSystem(lightingParticles);
|
|
else StopParticleSystem(lightingParticles);
|
|
} else {
|
|
StopParticleSystem(spawningPartciles);
|
|
StopParticleSystem(lightingParticles);
|
|
}
|
|
}
|
|
|
|
private void SetEmissionRate(ParticleSystem ps, float mult){
|
|
var emis = ps.emission;
|
|
emis.rateOverTimeMultiplier = mult;
|
|
}
|
|
|
|
}
|
|
}
|