Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- namespace Tools
- {
- public static class ColorExtension
- {
- public static float GetHue(this Color color)
- {
- Color.RGBToHSV(color, out var H, out var S, out var V);
- return H;
- }
- public static Color SetHue(Color color, float hue)
- {
- Color.RGBToHSV(color, out var H, out var S, out var V);
- return Color.HSVToRGB(hue, S, V);
- }
- }
- public static class VerifyExtension
- {
- public static void VerifyPositive(this float value, string parameterName, string message = "")
- {
- if (value < 0)
- throw new ArgumentOutOfRangeException(parameterName, message);
- }
- public static void VerifyNotNull<T>(this object targetObject, string parameterName, string message = "")
- where T : class
- {
- if (targetObject == null)
- {
- throw new ArgumentNullException(parameterName, message);
- }
- }
- public static void VerifyNotNull<T>(this T? targetObject, string parameterName, string message = "")
- where T : struct
- {
- if (targetObject == null)
- {
- throw new ArgumentNullException(parameterName, message);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment