quantum-space-buddies/QSB/EyeOfTheUniverse/GalaxyMap/Messages/ZoomOutMessage.cs

28 lines
973 B
C#
Raw Normal View History

2021-12-24 06:49:02 +00:00
using QSB.Messaging;
2021-12-23 11:37:37 +00:00
using QSB.WorldSync;
2021-12-24 01:07:29 +00:00
using System.Linq;
2021-12-23 11:37:37 +00:00
namespace QSB.EyeOfTheUniverse.GalaxyMap.Messages
2021-12-23 11:37:37 +00:00
{
2021-12-24 06:49:02 +00:00
internal class ZoomOutMessage : QSBMessage
2021-12-23 11:37:37 +00:00
{
2021-12-24 06:49:02 +00:00
public override bool ShouldReceive => WorldObjectManager.AllObjectsReady;
2021-12-23 11:37:37 +00:00
2021-12-24 06:49:02 +00:00
public override void OnReceiveRemote()
2021-12-23 11:37:37 +00:00
{
var controller = QSBWorldSync.GetUnityObjects<GalaxyMapController>().First();
controller.enabled = true;
Locator.GetPlayerController().SetColliderActivation(false);
controller._endlessObservatoryVolume.SetActivation(false);
controller._forestOfGalaxiesVolume.SetTriggerActivation(false);
ReticleController.Hide();
controller._zoomSpeed = 50f;
Locator.GetPlayerBody().AddVelocityChange(-Locator.GetPlayerCamera().transform.forward * controller._zoomSpeed);
controller._origEyePos = controller._eyeTransform.localPosition;
controller._audioSource.Play();
RumbleManager.PlayGalaxyZoom();
Locator.GetEyeStateManager().SetState(EyeState.ZoomOut);
}
}
}