2022-01-14 07:38:45 +00:00
|
|
|
|
using Mirror;
|
|
|
|
|
using QSB.ClientServerStateSync;
|
2021-12-26 00:10:41 +00:00
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.WorldSync;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2021-12-24 00:26:31 +00:00
|
|
|
|
namespace QSB.StatueSync.Messages
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-12-26 00:10:41 +00:00
|
|
|
|
internal class StartStatueMessage : QSBMessage
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-12-26 00:10:41 +00:00
|
|
|
|
private Vector3 PlayerPosition;
|
|
|
|
|
private Quaternion PlayerRotation;
|
|
|
|
|
private float CameraDegrees;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
|
2021-12-26 00:10:41 +00:00
|
|
|
|
public StartStatueMessage(Vector3 position, Quaternion rotation, float degrees)
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-12-26 00:10:41 +00:00
|
|
|
|
PlayerPosition = position;
|
|
|
|
|
PlayerRotation = rotation;
|
|
|
|
|
CameraDegrees = degrees;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-14 07:38:45 +00:00
|
|
|
|
public override void Serialize(NetworkWriter writer)
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
writer.Write(PlayerPosition);
|
|
|
|
|
writer.Write(PlayerRotation);
|
|
|
|
|
writer.Write(CameraDegrees);
|
|
|
|
|
}
|
2021-12-26 00:10:41 +00:00
|
|
|
|
|
2022-01-14 07:38:45 +00:00
|
|
|
|
public override void Deserialize(NetworkReader reader)
|
2021-12-26 00:10:41 +00:00
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
PlayerPosition = reader.ReadVector3();
|
|
|
|
|
PlayerRotation = reader.ReadQuaternion();
|
2022-01-14 07:38:45 +00:00
|
|
|
|
CameraDegrees = reader.Read<float>();
|
2021-12-26 00:10:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-18 08:27:32 +00:00
|
|
|
|
public override bool ShouldReceive => QSBWorldSync.AllObjectsReady;
|
2021-12-26 00:10:41 +00:00
|
|
|
|
|
|
|
|
|
public override void OnReceiveLocal()
|
|
|
|
|
{
|
|
|
|
|
if (QSBCore.IsHost)
|
|
|
|
|
{
|
|
|
|
|
ServerStateManager.Instance.SendChangeServerStateMessage(ServerState.InStatueCutscene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
|
|
|
|
if (QSBCore.IsHost)
|
|
|
|
|
{
|
|
|
|
|
ServerStateManager.Instance.SendChangeServerStateMessage(ServerState.InStatueCutscene);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatueManager.Instance.BeginSequence(PlayerPosition, PlayerRotation, CameraDegrees);
|
|
|
|
|
}
|
2021-02-28 14:43:05 +00:00
|
|
|
|
}
|
2021-12-26 00:10:41 +00:00
|
|
|
|
}
|