public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { checkTick = reader.ReadInt32(); renderTick = reader.ReadInt32(); moveYaw = reader.ReadFloatQ(); moveMagnitude = reader.ReadFloatQ(); lookYaw = reader.ReadFloat(); lookPitch = reader.ReadFloat(); jump = reader.ReadBoolean(); boost = reader.ReadBoolean(); sprint = reader.ReadBoolean(); primaryFire = reader.ReadBoolean(); secondaryFire = reader.ReadBoolean(); abilityA = reader.ReadBoolean(); reload = reader.ReadBoolean(); melee = reader.ReadBoolean(); use = reader.ReadBoolean(); emote = (CharacterEmote)reader.ReadByte(); //VR controls rightControllerPos = reader.ReadVector3Q(); leftControllerPos = reader.ReadVector3Q(); headsetPos = reader.ReadVector3Q(); rightControllerRot = reader.ReadQuaternion(); leftControllerRot = reader.ReadQuaternion(); headsetRot = reader.ReadQuaternion(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader networkReader) { checkTick = networkReader.ReadInt32(); renderTick = networkReader.ReadInt32(); moveYaw = networkReader.ReadFloatQ(); moveMagnitude = networkReader.ReadFloatQ(); lookYaw = networkReader.ReadFloat(); lookPitch = networkReader.ReadFloat(); buttons.flags = networkReader.ReadUInt32(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { state = (State)reader.ReadInt32(); actionStartTick = reader.ReadInt32(); ammoInClip = reader.ReadInt32(); fireRate = reader.ReadFloatQ(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { action = (State)reader.ReadInt32(); phaseStartTick = reader.ReadInt32(); ammoInClip = reader.ReadInt32(); COF = reader.ReadFloatQ(); }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { playerId = reader.ReadInt32(); playerName = reader.ReadString(); teamIndex = reader.ReadInt32(); score = reader.ReadInt32(); refSerializer.DeserializeReference(ref reader, ref controlledEntity); displayCountDown = reader.ReadBoolean(); countDown = reader.ReadInt32(); displayScoreBoard = reader.ReadBoolean(); displayGameScore = reader.ReadBoolean(); displayGameResult = reader.ReadBoolean(); gameResult = reader.ReadString(); displayGoal = reader.ReadBoolean(); goalPosition = reader.ReadVector3Q(); goalDefendersColor = reader.ReadUInt32(); goalAttackersColor = reader.ReadUInt32(); goalAttackers = reader.ReadUInt32(); goalDefenders = reader.ReadUInt32(); goalString = reader.ReadString(); actionString = reader.ReadString(); goalCompletion = reader.ReadFloatQ(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { var behaviour = context.entityManager.GetComponentObject <PlayerState>(context.entity); behaviour.playerId = reader.ReadInt32(); behaviour.playerName = reader.ReadString(); behaviour.teamIndex = reader.ReadInt32(); behaviour.score = reader.ReadInt32(); context.refSerializer.DeserializeReference(ref reader, ref behaviour.controlledEntity); behaviour.displayScoreBoard = reader.ReadBoolean(); behaviour.displayGameScore = reader.ReadBoolean(); behaviour.displayGameResult = reader.ReadBoolean(); behaviour.gameResult = reader.ReadString(); behaviour.displayGoal = reader.ReadBoolean(); behaviour.goalPosition = reader.ReadVector3Q(); behaviour.goalDefendersColor = reader.ReadUInt32(); behaviour.goalAttackersColor = reader.ReadUInt32(); behaviour.goalAttackers = reader.ReadUInt32(); behaviour.goalDefenders = reader.ReadUInt32(); behaviour.goalString = reader.ReadString(); behaviour.actionString = reader.ReadString(); behaviour.goalCompletion = reader.ReadFloatQ(); }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { action = (Action)reader.ReadInt32(); phaseStartTick = reader.ReadInt32(); ammoInClip = reader.ReadInt32(); COF = reader.ReadFloatQ(); }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { objectiveName = reader.ReadString(); status = (Status)reader.ReadByte(); captured = reader.ReadFloatQ(); // TODO (petera) replace with proper cross scene reference system foreach (var i in CapturePointReference.capturePointReferences) { if (i.index == captureIndex && i.animator != null) { int captured = 0; if (status == Status.Capturing || status == Status.Contested) { captured = 1; } else if (status == Status.Completed) { captured = 2; } i.animator.SetInteger("Captured", captured); } } }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { var behaviour = context.entityManager.GetComponentObject <CapturePoint>(context.entity); behaviour.objectiveName = reader.ReadString(); behaviour.status = (CapturePoint.Status)reader.ReadByte(); behaviour.captured = reader.ReadFloatQ(); // TODO (petera) replace with proper cross scene reference system foreach (var i in CapturePointReference.capturePointReferences) { if (i.index == behaviour.captureIndex && i.animator != null) { int captured = 0; if (behaviour.status == CapturePoint.Status.Capturing || behaviour.status == CapturePoint.Status.Contested) { captured = 1; } else if (behaviour.status == CapturePoint.Status.Completed) { captured = 2; } i.animator.SetInteger("Captured", captured); } } }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { center = reader.ReadVector3Q(); radius = reader.ReadFloatQ(); var v = reader.ReadVector3Q(); color = new Color(v.x, v.y, v.z); }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { phase = (Phase)reader.ReadInt32(); phaseStartTick = reader.ReadInt32(); ammoInClip = reader.ReadInt32(); reloadRequested = reader.ReadBoolean() ? 1 : 0; fireRate = reader.ReadFloatQ(); }
public void Deserialize(ref NetworkReader networkReader, IEntityReferenceSerializer refSerializer, int tick) { checkTick = networkReader.ReadInt32(); renderTick = networkReader.ReadInt32(); moveYaw = networkReader.ReadFloatQ(); moveMagnitude = networkReader.ReadFloatQ(); lookYaw = networkReader.ReadFloat(); lookPitch = networkReader.ReadFloat(); jump = networkReader.ReadBoolean(); boost = networkReader.ReadBoolean(); sprint = networkReader.ReadBoolean(); primaryFire = networkReader.ReadBoolean(); secondaryFire = networkReader.ReadBoolean(); abilityA = networkReader.ReadBoolean(); reload = networkReader.ReadBoolean(); melee = networkReader.ReadBoolean(); use = networkReader.ReadBoolean(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { Position = reader.ReadVector3Q(); Rotation = reader.ReadQuaternionQ(); Velocity = reader.ReadFloatQ(); IsTake = reader.ReadBoolean(); IsSlice = reader.ReadBoolean(); IsClean = reader.ReadBoolean(); IsThrow = reader.ReadBoolean(); MaterialId = reader.ReadUInt16(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { position = reader.ReadVector3Q(); rotation = reader.ReadFloatQ(); aimYaw = reader.ReadFloatQ(); aimPitch = reader.ReadFloatQ(); moveYaw = reader.ReadFloatQ(); charLocoState = (CharacterPredictedData.LocoState)reader.ReadInt32(); charLocoTick = reader.ReadInt32(); charAction = (CharacterPredictedData.Action)reader.ReadInt32(); charActionTick = reader.ReadInt32(); sprinting = reader.ReadBoolean() ? 1 : 0; sprintWeight = reader.ReadFloatQ(); damageTick = reader.ReadInt32(); damageDirection = reader.ReadFloatQ(); //moveAngleLocal = reader.ReadFloatQ(); //shootPoseWeight = reader.ReadFloatQ(); //locomotionVector = reader.ReadVector2Q(); //locomotionPhase = reader.ReadFloatQ(); //banking = reader.ReadFloatQ(); //landAnticWeight = reader.ReadFloatQ(); //turnStartAngle = reader.ReadFloatQ(); //turnDirection = reader.ReadInt16(); //squashTime = reader.ReadFloatQ(); //squashWeight = reader.ReadFloatQ(); //inAirTime = reader.ReadFloatQ(); //jumpTime = reader.ReadFloatQ(); //simpleTime = reader.ReadFloatQ(); //footIkOffset = reader.ReadVector2Q(); //footIkNormalLeft = reader.ReadVector3Q(); //footIkNormaRight = reader.ReadVector3Q(); }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { position = reader.ReadVector3Q(); rotation = reader.ReadFloatQ(); aimYaw = reader.ReadFloatQ(); aimPitch = reader.ReadFloatQ(); moveYaw = reader.ReadFloatQ(); charLocoState = (CharPredictedStateData.LocoState)reader.ReadInt32(); charLocoTick = reader.ReadInt32(); charAction = (CharPredictedStateData.Action)reader.ReadInt32(); charActionTick = reader.ReadInt32(); sprinting = reader.ReadBoolean() ? 1 : 0; sprintWeight = reader.ReadFloatQ(); damageTick = reader.ReadInt32(); damageDirection = reader.ReadFloatQ(); moveAngleLocal = reader.ReadFloatQ(); shootPoseWeight = reader.ReadFloatQ(); locomotionVector = reader.ReadVector2Q(); locomotionPhase = reader.ReadFloatQ(); banking = reader.ReadFloatQ(); landAnticWeight = reader.ReadFloatQ(); turnStartAngle = reader.ReadFloatQ(); turnDirection = reader.ReadInt16(); squashTime = reader.ReadFloatQ(); squashWeight = reader.ReadFloatQ(); inAirTime = reader.ReadFloatQ(); jumpTime = reader.ReadFloatQ(); simpleTime = reader.ReadFloatQ(); footIkOffset = reader.ReadVector2Q(); footIkNormalLeft = reader.ReadVector3Q(); footIkNormaRight = reader.ReadVector3Q(); }
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick) { resetCommandTick = reader.ReadInt32(); resetCommandLookYaw = reader.ReadFloatQ(); resetCommandLookPitch = reader.ReadFloatQ(); }
public void Deserialize(ref SerializeContext context, ref NetworkReader reader) { resetCommandTick = reader.ReadInt32(); resetCommandLookYaw = reader.ReadFloatQ(); resetCommandLookPitch = reader.ReadFloatQ(); }
unsafe public static void ReadAndAssertValues(List <object> values, uint[] buffer, NetworkSchema schema) { fixed(uint *buf = buffer) { NetworkReader reader = new NetworkReader(buf, schema); for (int j = 0; j < schema.numFields; ++j) { var value = values[j]; var field = schema.fields[j]; if (value is bool) { Assert.AreEqual(value, reader.ReadBoolean()); } else if (value is byte) { Assert.AreEqual(value, reader.ReadByte()); } else if (value is ushort) { Assert.AreEqual(value, reader.ReadUInt16()); } else if (value is short) { Assert.AreEqual(value, reader.ReadInt16()); } else if (value is uint) { Assert.AreEqual(value, reader.ReadUInt32()); } else if (value is int) { Assert.AreEqual(value, reader.ReadInt32()); } else if (value is float) { var expected = (float)value; if (field.delta) { var actual = reader.ReadFloatQ(); Assert.IsTrue(Math.Abs(actual - expected) < Math.Pow(10, -field.precision)); } else { var actual = reader.ReadFloat(); Assert.AreEqual(expected, actual); } } else if (value is Vector2) { var expected = (Vector2)value; if (field.delta) { var actual = reader.ReadVector2Q(); Assert.IsTrue(Math.Abs(actual.x - expected.x) < Math.Pow(10, -field.precision)); Assert.IsTrue(Math.Abs(actual.y - expected.y) < Math.Pow(10, -field.precision)); } else { var actual = reader.ReadVector2(); Assert.AreEqual(expected.x, actual.x); Assert.AreEqual(expected.y, actual.y); } } else if (value is Vector3) { var expected = (Vector3)value; if (field.delta) { var actual = reader.ReadVector3Q(); Assert.IsTrue(Math.Abs(actual.x - expected.x) < Math.Pow(10, -field.precision)); Assert.IsTrue(Math.Abs(actual.y - expected.y) < Math.Pow(10, -field.precision)); Assert.IsTrue(Math.Abs(actual.z - expected.z) < Math.Pow(10, -field.precision)); } else { var actual = reader.ReadVector3(); Assert.AreEqual(expected.x, actual.x); Assert.AreEqual(expected.y, actual.y); Assert.AreEqual(expected.z, actual.z); } } else if (value is Quaternion) { var expected = (Quaternion)value; if (field.delta) { var actual = reader.ReadQuaternionQ(); Assert.IsTrue(Math.Abs(actual.x - expected.x) < Math.Pow(10, -field.precision)); Assert.IsTrue(Math.Abs(actual.y - expected.y) < Math.Pow(10, -field.precision)); Assert.IsTrue(Math.Abs(actual.z - expected.z) < Math.Pow(10, -field.precision)); Assert.IsTrue(Math.Abs(actual.w - expected.w) < Math.Pow(10, -field.precision)); } else { var actual = reader.ReadQuaternion(); Assert.AreEqual(expected.x, actual.x); Assert.AreEqual(expected.y, actual.y); Assert.AreEqual(expected.z, actual.z); Assert.AreEqual(expected.w, actual.w); } } else if (value is string) { var actual = reader.ReadString(1024); if (value != null) { Assert.AreEqual(value, actual); } else { Assert.AreEqual("", actual); } } else if (value is byte[]) { var expected = (byte[])value; var actual = new byte[10]; var length = reader.ReadBytes(actual, 0, 1024); Assert.AreEqual(10, length); for (int b = 0; b < 10; ++b) { Assert.AreEqual(expected[b], actual[b]); } } else if (value == null && field.fieldType == NetworkSchema.FieldType.String) { var actual = reader.ReadString(1024); Assert.AreEqual("", actual); } else { Assert.Fail(); } } } }