public void DisableTimeWarp() { if (TimeWarpObject != null) { TimeWarpObject.SetActive(false); } foreach (var PlayerControl in PlayerControl.AllPlayerControls) { var Physics = PlayerControl.MyPhysics; Physics.Speed = Speed; Physics.GhostSpeed = GhostSpeed; } IsActive = false; }
public void EnableTimeWarp() { if (TimeWarpObject == null && Player != null) { TimeWarpObject = Object.Instantiate(ExtraResources.TIME_WARP, Player.transform); TimeWarpObject.SetActive(false); } if (Player != null) { var LocalPlayer = PlayerControl.LocalPlayer; if (LocalPlayer.PlayerId == Player.PlayerId || Show) { TimeWarpObject.SetActive(true); } } var Mod = 1f / PlayerControl.GameOptions.PlayerSpeedMod * TimeWarpSpeed; var SpeedNew = Speed * Mod; var GhostSpeedNew = GhostSpeed * Mod; foreach (var PlayerControl in PlayerControl.AllPlayerControls) { var Physics = PlayerControl.MyPhysics; if (!TimeWarpSelf && PlayerControl.Compare(Player)) { Physics.Speed = Speed; Physics.GhostSpeed = GhostSpeed; } else { Physics.Speed = SpeedNew; Physics.GhostSpeed = GhostSpeedNew; } } TimeWarpCooldown.Use(); IsActive = true; }