public static bool Prefix(ObstacleController __instance, ObstacleData obstacleData, Vector3 startPos, Vector3 midPos, Vector3 endPos, float move1Duration, float move2Duration, float startTimeOffset, float singleLineWidth, float height, ref bool ____initialized, ref ObstacleData ____obstacleData, ref float ____obstacleDuration, ref Vector3 ____startPos, ref Vector3 ____midPos, ref Vector3 ____endPos, ref float ____move1Duration, ref float ____move2Duration, ref float ____startTimeOffset, ref StretchableObstacle ____stretchableObstacle, ref Bounds ____bounds, ref bool ____passedThreeQuartersOfMove2Reported, ref bool ____passedAvoidedMarkReported, ref float ____passedAvoidedMarkTime, ref float ____finishMovementTime, ref Action <ObstacleController> ___didInitEvent, ref SimpleColorSO ____color) { if (!Plugin.active) { return(true); } ____initialized = true; ____obstacleData = obstacleData; ____obstacleDuration = obstacleData.duration; float num = obstacleData.width * singleLineWidth; Vector3 vector = __instance.transform.rotation * new Vector3((num - singleLineWidth) * 0.5f, 0f, 0f); ____startPos = startPos + vector; ____midPos = midPos + vector; ____midPos.y = ____startPos.y; ____endPos = endPos + vector; ____endPos.y = ____startPos.y; ____move1Duration = move1Duration; ____move2Duration = move2Duration; ____startTimeOffset = startTimeOffset; float length = (____endPos - ____midPos).magnitude / move2Duration * obstacleData.duration; ____stretchableObstacle.SetSizeAndColor(num * 0.98f, height, length, ____color); ____bounds = ____stretchableObstacle.bounds; ____passedThreeQuartersOfMove2Reported = false; ____passedAvoidedMarkReported = false; ____passedAvoidedMarkTime = ____move1Duration + ____move2Duration * 0.5f + ____obstacleDuration + 0.15f; ____finishMovementTime = ____move1Duration + ____move2Duration + ____obstacleDuration; ___didInitEvent?.Invoke(__instance); return(false); }
static void Postfix(ref ObstacleController __instance, ObstacleData obstacleData, Vector3 startPos, Vector3 midPos, Vector3 endPos, float move1Duration, float move2Duration, float startTimeOffset, float singleLineWidth, ref bool ____initialized, ref Vector3 ____startPos, ref Vector3 ____endPos, ref Vector3 ____midPos, ref StretchableObstacle ____stretchableObstacle, ref Bounds ____bounds, ref Color ____color, ref float height) { if (!Plugin.active) { return; } if (obstacleData.width >= 1000 || (((int)obstacleData.obstacleType >= 1000 && (int)obstacleData.obstacleType <= 4000) || ((int)obstacleData.obstacleType >= 4001 && (int)obstacleData.obstacleType <= 4005000))) { Mode mode = ((int)obstacleData.obstacleType >= 4001 && (int)obstacleData.obstacleType <= 4100000) ? Mode.preciseHeightStart : Mode.preciseHeight; int obsHeight = 0; int startHeight = 0; if (mode == Mode.preciseHeightStart) { int value = (int)obstacleData.obstacleType; value -= 4001; obsHeight = value / 1000; startHeight = value % 1000; // Console.WriteLine(height + "<---Height StartHeight---> " + startHeight); } else { int value = (int)obstacleData.obstacleType; obsHeight = value - 1000; } float num = 0; if ((obstacleData.width >= 1000) || (mode == Mode.preciseHeightStart)) { float width = (float)obstacleData.width - 1000; float precisionLineWidth = singleLineWidth / 1000; num = width * precisionLineWidth; //Change y of b for start height Vector3 b = new Vector3((num - singleLineWidth) * 0.5f, 4 * ((float)startHeight / 1000), 0f); ____startPos = startPos + b; ____midPos = midPos + b; ____endPos = endPos + b; } else { num = (float)obstacleData.width * singleLineWidth; } float num2 = (____endPos - ____midPos).magnitude / move2Duration; float length = num2 * obstacleData.duration; float multiplier = 1f; if ((int)obstacleData.obstacleType >= 1000) { multiplier = (float)obsHeight / 1000f; } if (currentObstacleColor == null) { currentObstacleColor = Resources.FindObjectsOfTypeAll <ColorManager>().First().GetPrivateField <SimpleColorSO>("_obstaclesColor").color; } ____stretchableObstacle.SetSizeAndColor(Mathf.Abs(num * 0.98f), Mathf.Abs(height * multiplier), Mathf.Abs(length), currentObstacleColor.Value); ____bounds = ____stretchableObstacle.bounds; // ____stretchableObstacle.transform.localRotation *= Quaternion.Euler(new Vector3(0, 0, 180f)); } }
private void UpdateWallColor(Color color) { foreach (ObstacleController wall in beatmapObjectManager.activeObstacleControllers) { StretchableObstacle stretchable = Helper.GetValue <StretchableObstacle>(wall, "_stretchableObstacle"); ParametricBoxFrameController frame = Helper.GetValue <ParametricBoxFrameController>(stretchable, "_obstacleFrame"); stretchable.SetSizeAndColor(frame.width, frame.height, frame.length, color); } }
public static void Init(ObstacleController __instance) { if (ColorController.isNull || !ColorController.instance.useCustomWallColor) { return; } Color color = ColorController.instance.wallColor; if (Helper.IsRainbow(color)) { color = RainbowController.instance.GetWallColor(); } StretchableObstacle stretchable = Helper.GetValue <StretchableObstacle>(__instance, "_stretchableObstacle"); ParametricBoxFrameController frame = Helper.GetValue <ParametricBoxFrameController>(stretchable, "_obstacleFrame"); stretchable.SetSizeAndColor(frame.width, frame.height, frame.length, color); }