public override void AddNetworkPacket(InterpolatedObject c, int timeMilliseconds) { Packet_ p = new Packet_(); p.content = c; p.timestampMilliseconds = timeMilliseconds; int max = 100; if (receivedCount >= max) { for (int i = 0; i < max - 1; i++) { received[i] = received[i + 1]; } receivedCount = max - 1; } received[receivedCount++] = p; }
public abstract PlayerInterpolationState CastToPlayerInterpolationState(InterpolatedObject a);
public override InterpolatedObject Interpolate(InterpolatedObject a, InterpolatedObject b, float progress) { PlayerInterpolationState aa = platform.CastToPlayerInterpolationState(a); PlayerInterpolationState bb = platform.CastToPlayerInterpolationState(b); PlayerInterpolationState cc = new PlayerInterpolationState(); cc.positionX = aa.positionX + (bb.positionX - aa.positionX) * progress; cc.positionY = aa.positionY + (bb.positionY - aa.positionY) * progress; cc.positionZ = aa.positionZ + (bb.positionZ - aa.positionZ) * progress; //cc.heading = Game.IntToByte(AngleInterpolation.InterpolateAngle256(platform, aa.heading, bb.heading, progress)); //cc.pitch = Game.IntToByte(AngleInterpolation.InterpolateAngle256(platform, aa.pitch, bb.pitch, progress)); cc.rotx = DegToRad(AngleInterpolation.InterpolateAngle360(platform, RadToDeg(aa.rotx), RadToDeg(bb.rotx), progress)); cc.roty = DegToRad(AngleInterpolation.InterpolateAngle360(platform, RadToDeg(aa.roty), RadToDeg(bb.roty), progress)); cc.rotz = DegToRad(AngleInterpolation.InterpolateAngle360(platform, RadToDeg(aa.rotz), RadToDeg(bb.rotz), progress)); return cc; }
public abstract void AddNetworkPacket(InterpolatedObject c, int timeMilliseconds);
public abstract InterpolatedObject Interpolate(InterpolatedObject a, InterpolatedObject b, float progress);
public override PlayerInterpolationState CastToPlayerInterpolationState(InterpolatedObject a) { return (PlayerInterpolationState)a; }