public static void Postfix() { if (rewinding) { Rewind(); } else { Record(); } if (rewinding) { foreach (var role in Role.GetRoles(RoleEnum.TimeLord)) { var timeLord = (TimeLord)role; if (timeLord.IsRewinding) { timeLord.TimeRemaining -= Time.deltaTime; } else { StartStop.StopRewind(timeLord); } } } }
public static void Postfix() { if (rewinding) { Rewind(); } else { Record(); } foreach (var role in Role.GetRoles(RoleEnum.TimeLord)) { var TimeLord = (TimeLord)role; if ((DateTime.UtcNow - TimeLord.StartRewind).TotalMilliseconds > CustomGameOptions.RewindDuration * 1000f && TimeLord.FinishRewind < TimeLord.StartRewind) { StartStop.StopRewind(TimeLord); } } }
private static void Rewind() { if (Minigame.Instance) { try { Minigame.Instance.Close(); } catch { } } //System.Console.WriteLine("Rewinding..."); //System.Console.Write(points.Count); if (points.Count > 2) { points.RemoveAt(0); points.RemoveAt(0); if (PlayerControl.LocalPlayer.inVent) { PlayerControl.LocalPlayer.MyPhysics.RpcExitVent(Vent.currentVent.Id); PlayerControl.LocalPlayer.MyPhysics.ExitAllVents(); } if (!PlayerControl.LocalPlayer.inVent) { if (!PlayerControl.LocalPlayer.Collider.enabled) { PlayerControl.LocalPlayer.MyPhysics.ResetMoveState(); PlayerControl.LocalPlayer.Collider.enabled = true; PlayerControl.LocalPlayer.NetTransform.enabled = true; var writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.FixAnimation, SendOption.Reliable, -1); writer.Write(PlayerControl.LocalPlayer.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(writer); } var currentPoint = points[0]; PlayerControl.LocalPlayer.transform.position = currentPoint.position; PlayerControl.LocalPlayer.gameObject.GetComponent <Rigidbody2D>().velocity = currentPoint.velocity * 3; if (isDead && currentPoint.unix < deadTime && PlayerControl.LocalPlayer.Data.IsDead && CustomGameOptions.RewindRevive) { var player = PlayerControl.LocalPlayer; ReviveBody(player); player.myTasks.RemoveAt(0); deadTime = 0; isDead = false; var write = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.RewindRevive, SendOption.Reliable, -1); write.Write(PlayerControl.LocalPlayer.PlayerId); AmongUsClient.Instance.FinishRpcImmediately(write); } } points.RemoveAt(0); } else { StartStop.StopRewind(whoIsRewinding); } }