mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
AvatarScaleMod: renamed folder
This commit is contained in:
parent
a1d73bf156
commit
fd4fe2ea9d
28 changed files with 6 additions and 6 deletions
132
AvatarScaleMod/AvatarScaling/ScaledComponents.cs
Normal file
132
AvatarScaleMod/AvatarScaling/ScaledComponents.cs
Normal file
|
@ -0,0 +1,132 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
|
||||
namespace NAK.AvatarScaleMod.ScaledComponents;
|
||||
|
||||
public class ScaledAudioSource
|
||||
{
|
||||
private readonly AudioSource Component;
|
||||
private readonly float InitialMinDistance;
|
||||
private readonly float InitialMaxDistance;
|
||||
|
||||
public ScaledAudioSource(AudioSource component)
|
||||
{
|
||||
Component = component;
|
||||
InitialMinDistance = component.minDistance;
|
||||
InitialMaxDistance = component.maxDistance;
|
||||
}
|
||||
|
||||
public void Scale(float scaleFactor)
|
||||
{
|
||||
Component.minDistance = InitialMinDistance * scaleFactor;
|
||||
Component.maxDistance = InitialMaxDistance * scaleFactor;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Component.minDistance = InitialMinDistance;
|
||||
Component.maxDistance = InitialMaxDistance;
|
||||
}
|
||||
}
|
||||
|
||||
public class ScaledLight
|
||||
{
|
||||
private readonly Light Component;
|
||||
private readonly float InitialRange;
|
||||
|
||||
public ScaledLight(Light component)
|
||||
{
|
||||
Component = component;
|
||||
InitialRange = component.range;
|
||||
}
|
||||
|
||||
public void Scale(float scaleFactor)
|
||||
{
|
||||
Component.range = InitialRange * scaleFactor;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Component.range = InitialRange;
|
||||
}
|
||||
}
|
||||
|
||||
public class ScaledPositionConstraint
|
||||
{
|
||||
private readonly PositionConstraint Component;
|
||||
private readonly Vector3 InitialTranslationAtRest;
|
||||
private readonly Vector3 InitialTranslationOffset;
|
||||
|
||||
public ScaledPositionConstraint(PositionConstraint component)
|
||||
{
|
||||
Component = component;
|
||||
InitialTranslationAtRest = component.translationAtRest;
|
||||
InitialTranslationOffset = component.translationOffset;
|
||||
}
|
||||
|
||||
public void Scale(float scaleFactor)
|
||||
{
|
||||
Component.translationAtRest = InitialTranslationAtRest * scaleFactor;
|
||||
Component.translationOffset = InitialTranslationOffset * scaleFactor;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Component.translationAtRest = InitialTranslationAtRest;
|
||||
Component.translationOffset = InitialTranslationOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public class ScaledParentConstraint
|
||||
{
|
||||
private readonly ParentConstraint Component;
|
||||
private readonly Vector3 InitialTranslationAtRest;
|
||||
private readonly List<Vector3> InitialTranslationOffsets;
|
||||
|
||||
public ScaledParentConstraint(ParentConstraint component)
|
||||
{
|
||||
Component = component;
|
||||
InitialTranslationAtRest = component.translationAtRest;
|
||||
InitialTranslationOffsets = component.translationOffsets.ToList();
|
||||
}
|
||||
|
||||
public void Scale(float scaleFactor)
|
||||
{
|
||||
Component.translationAtRest = InitialTranslationAtRest * scaleFactor;
|
||||
for (int i = 0; i < InitialTranslationOffsets.Count; i++)
|
||||
Component.translationOffsets[i] = InitialTranslationOffsets[i] * scaleFactor;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Component.translationAtRest = InitialTranslationAtRest;
|
||||
for (int i = 0; i < InitialTranslationOffsets.Count; i++)
|
||||
Component.translationOffsets[i] = InitialTranslationOffsets[i];
|
||||
}
|
||||
}
|
||||
|
||||
public class ScaledScaleConstraint
|
||||
{
|
||||
private readonly ScaleConstraint Component;
|
||||
private readonly Vector3 InitialScaleAtRest;
|
||||
private readonly Vector3 InitialScaleOffset;
|
||||
|
||||
public ScaledScaleConstraint(ScaleConstraint component)
|
||||
{
|
||||
Component = component;
|
||||
InitialScaleAtRest = component.scaleAtRest;
|
||||
InitialScaleOffset = component.scaleOffset;
|
||||
}
|
||||
|
||||
public void Scale(float scaleFactor)
|
||||
{
|
||||
Component.scaleAtRest = InitialScaleAtRest * scaleFactor;
|
||||
// Component.scaleOffset = InitialScaleOffset * scaleFactor;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Component.scaleAtRest = InitialScaleAtRest;
|
||||
Component.scaleOffset = InitialScaleOffset;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue