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 = (CharacterPredictedState.StateData.LocoState)reader.ReadInt32(); charLocoTick = reader.ReadInt32(); charAction = (CharacterPredictedState.StateData.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 GenerateStateChangeEvents(ref CharAnimState animState) { if (animState.charLocoState != previousLocoState) { if (animState.charLocoState == CharacterPredictedState.StateData.LocoState.DoubleJump) { onDoubleJump = true; } if (animState.charLocoState == CharacterPredictedState.StateData.LocoState.Stand || animState.charLocoState == CharacterPredictedState.StateData.LocoState.GroundMove) { if (previousLocoState == CharacterPredictedState.StateData.LocoState.InAir || previousLocoState == CharacterPredictedState.StateData.LocoState.DoubleJump) { onLand = true; } } if (animState.charLocoState == CharacterPredictedState.StateData.LocoState.Jump) { onJumpStart = true; } previousLocoState = animState.charLocoState; } }
public void Interpolate(ref CharAnimState prevState, ref CharAnimState nextState, float f) { position = Vector3.Lerp(prevState.position, nextState.position, f); rotation = Mathf.LerpAngle(prevState.rotation, nextState.rotation, f); aimYaw = Mathf.LerpAngle(prevState.aimYaw, nextState.aimYaw, f); aimPitch = Mathf.LerpAngle(prevState.aimPitch, nextState.aimPitch, f); moveYaw = Mathf.LerpAngle(prevState.moveYaw, nextState.moveYaw, f); charLocoState = prevState.charLocoState; charLocoTick = prevState.charLocoTick; charAction = prevState.charAction; charActionTick = prevState.charActionTick; sprinting = prevState.sprinting; sprintWeight = Mathf.Lerp(prevState.sprintWeight, nextState.sprintWeight, f); damageTick = prevState.damageTick; damageDirection = prevState.damageDirection; moveAngleLocal = Mathf.LerpAngle(prevState.moveAngleLocal, nextState.moveAngleLocal, f); shootPoseWeight = Mathf.Lerp(prevState.shootPoseWeight, nextState.shootPoseWeight, f); locomotionVector = Vector2.Lerp(prevState.locomotionVector, nextState.locomotionVector, f); locomotionPhase = Mathf.Lerp(prevState.locomotionPhase, nextState.locomotionPhase, f); banking = Mathf.Lerp(prevState.banking, nextState.banking, f); landAnticWeight = Mathf.Lerp(prevState.landAnticWeight, nextState.landAnticWeight, f); turnStartAngle = prevState.turnStartAngle; turnDirection = prevState.turnDirection; squashTime = Mathf.Lerp(prevState.squashTime, nextState.squashTime, f); squashWeight = Mathf.Lerp(prevState.squashWeight, nextState.squashWeight, f); inAirTime = Mathf.Lerp(prevState.inAirTime, nextState.inAirTime, f); jumpTime = Mathf.Lerp(prevState.jumpTime, nextState.jumpTime, f); simpleTime = Mathf.Lerp(prevState.simpleTime, nextState.simpleTime, f); footIkOffset = Vector2.Lerp(prevState.footIkOffset, nextState.footIkOffset, f); footIkNormalLeft = Vector3.Lerp(prevState.footIkNormalLeft, nextState.footIkNormalLeft, f); footIkNormaRight = Vector3.Lerp(prevState.footIkNormaRight, nextState.footIkNormaRight, f); }