All checks were successful
Build project / Build for (StandaloneLinux64, 6000.0.37f1) (push) Successful in 5m17s
Build project / Build for (StandaloneWindows64, 6000.0.37f1) (push) Successful in 5m19s
Build project / Publish to itch.io (StandaloneLinux64) (push) Successful in 5s
Build project / Publish to itch.io (StandaloneWindows64) (push) Successful in 5s
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
|
|
/// <summary>
|
|
/// Utility functions
|
|
/// </summary>
|
|
public static class Utility {
|
|
/// <summary>
|
|
/// Bool conversion to int (false=-1, true=1)
|
|
/// </summary>
|
|
/// <param name="val"></param>
|
|
/// <returns></returns>
|
|
public static int ToIntSign(this bool val) {
|
|
return val ? 1 : -1;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Multiplies the TimeSpan with the given integer
|
|
/// </summary>
|
|
/// <param name="ts"></param>
|
|
/// <param name="num"></param>
|
|
/// <returns></returns>
|
|
public static TimeSpan Multiply(this TimeSpan ts, int num) {
|
|
return TimeSpan.FromTicks(ts.Ticks * num);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Multiplier the TimeSpan with the given float
|
|
/// </summary>
|
|
/// <param name="ts"></param>
|
|
/// <param name="num"></param>
|
|
/// <returns></returns>
|
|
public static TimeSpan Multiply(this TimeSpan ts, float num) {
|
|
return TimeSpan.FromTicks((long)(ts.Ticks * num));
|
|
}
|
|
} |