2021-12-25 16:10:41 -08:00
|
|
|
|
using QSB.ClientServerStateSync;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using QSB.WorldSync;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
using QuantumUNET.Transport;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2021-12-23 16:26:31 -08:00
|
|
|
|
namespace QSB.StatueSync.Messages
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-12-25 16:10:41 -08:00
|
|
|
|
internal class StartStatueMessage : QSBMessage
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-12-25 16:10:41 -08:00
|
|
|
|
private Vector3 PlayerPosition;
|
|
|
|
|
private Quaternion PlayerRotation;
|
|
|
|
|
private float CameraDegrees;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
|
2021-12-25 16:10:41 -08:00
|
|
|
|
public StartStatueMessage(Vector3 position, Quaternion rotation, float degrees)
|
2021-02-28 14:43:05 +00:00
|
|
|
|
{
|
2021-12-25 16:10:41 -08:00
|
|
|
|
PlayerPosition = position;
|
|
|
|
|
PlayerRotation = rotation;
|
|
|
|
|
CameraDegrees = degrees;
|
2021-02-28 14:43:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-25 16:10:41 -08:00
|
|
|
|
public StartStatueMessage() { }
|
|
|
|
|
|
2021-02-28 14:43:05 +00:00
|
|
|
|
public override void Serialize(QNetworkWriter writer)
|
|
|
|
|
{
|
|
|
|
|
base.Serialize(writer);
|
|
|
|
|
writer.Write(PlayerPosition);
|
|
|
|
|
writer.Write(PlayerRotation);
|
|
|
|
|
writer.Write(CameraDegrees);
|
|
|
|
|
}
|
2021-12-25 16:10:41 -08:00
|
|
|
|
|
|
|
|
|
public override void Deserialize(QNetworkReader reader)
|
|
|
|
|
{
|
|
|
|
|
base.Deserialize(reader);
|
|
|
|
|
PlayerPosition = reader.ReadVector3();
|
|
|
|
|
PlayerRotation = reader.ReadQuaternion();
|
|
|
|
|
CameraDegrees = reader.ReadSingle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool ShouldReceive => WorldObjectManager.AllObjectsReady;
|
|
|
|
|
|
|
|
|
|
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-25 16:10:41 -08:00
|
|
|
|
}
|