2022-01-12 23:08:07 +00:00
|
|
|
|
using QSB.EyeOfTheUniverse.EyeStateSync.Messages;
|
2022-01-13 06:08:06 +00:00
|
|
|
|
using QSB.Messaging;
|
2022-01-13 16:38:34 +00:00
|
|
|
|
using QSB.Player;
|
|
|
|
|
using QSB.Utility;
|
2022-01-12 04:00:47 +00:00
|
|
|
|
using QSB.WorldSync;
|
2022-01-15 16:22:46 +00:00
|
|
|
|
using System.Collections.Generic;
|
2022-01-12 04:00:47 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
namespace QSB.EyeOfTheUniverse.MaskSync;
|
|
|
|
|
|
2023-07-28 18:30:57 +00:00
|
|
|
|
public class MaskManager : MonoBehaviour, IAddComponentOnStart
|
2022-01-12 04:00:47 +00:00
|
|
|
|
{
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private static bool _flickering;
|
|
|
|
|
private static float _flickerOutTime;
|
2022-01-12 23:08:07 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public static List<PlayerInfo> WentOnSolanumsWildRide = new();
|
2022-01-13 16:38:34 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private void Awake() => QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
2022-01-12 23:08:07 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private static void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool inUniverse)
|
|
|
|
|
{
|
|
|
|
|
_flickering = false;
|
|
|
|
|
_flickerOutTime = 0f;
|
|
|
|
|
}
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
public static void FlickerOutShuttle()
|
|
|
|
|
{
|
|
|
|
|
FlickerMessage.IgnoreNextMessage = true;
|
|
|
|
|
GlobalMessenger<float, float>.FireEvent(OWEvents.FlickerOffAndOn, 0.5f, 0.5f);
|
|
|
|
|
_flickerOutTime = Time.time + 0.5f;
|
|
|
|
|
_flickering = true;
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
// hide all players in shuttle
|
|
|
|
|
QSBPlayerManager.PlayerList.Where(x => x.IsInEyeShuttle).ForEach(x => x.SetVisible(false));
|
|
|
|
|
}
|
2022-02-27 12:40:44 +00:00
|
|
|
|
|
2022-03-03 03:46:33 +00:00
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
if (_flickering && Time.time > _flickerOutTime)
|
2022-02-27 12:40:44 +00:00
|
|
|
|
{
|
2022-05-03 07:48:24 +00:00
|
|
|
|
var controller = QSBWorldSync.GetUnityObject<EyeShuttleController>();
|
2022-03-03 03:46:33 +00:00
|
|
|
|
controller._shuttleObject.SetActive(false);
|
|
|
|
|
_flickering = false;
|
|
|
|
|
_flickerOutTime = 0f;
|
2022-02-27 12:40:44 +00:00
|
|
|
|
}
|
2022-01-12 04:00:47 +00:00
|
|
|
|
}
|
2022-02-25 06:04:54 +00:00
|
|
|
|
}
|