mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Refactored RecordRandomizer
This commit is contained in:
parent
3c4060f8bd
commit
b99b74e27b
2 changed files with 130 additions and 90 deletions
|
@ -18,13 +18,25 @@ namespace RJWSexperience
|
|||
|
||||
return ((float)res).Denormalization(min, max);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set exact <paramref name="value"/> for the <paramref name="record"/>
|
||||
/// </summary>
|
||||
public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value)
|
||||
{
|
||||
float recordval = records.GetValue(record);
|
||||
records.AddTo(record, value - recordval);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set exact <paramref name="value"/> for the <paramref name="record"/>
|
||||
/// </summary>
|
||||
public static void Set(this Pawn_RecordsTracker records, RecordDef record, int value)
|
||||
{
|
||||
int currentValue = records.GetAsInt(record);
|
||||
records.AddTo(record, value - currentValue);
|
||||
}
|
||||
|
||||
public static float Normalization(this float num, float min, float max)
|
||||
{
|
||||
return (num - min) / (max - min);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue