mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[AvatarScaleMod] Mod Network attempt 2.
I lost the first attempt when switching branches. Lot of this still needs to be redone, as it is just quickly slapped together atm.
This commit is contained in:
parent
69cb3b7804
commit
d599f57973
13 changed files with 850 additions and 544 deletions
133
AvatarScale/AvatarScaling/ScaledComponents.cs
Normal file
133
AvatarScale/AvatarScaling/ScaledComponents.cs
Normal file
|
@ -0,0 +1,133 @@
|
|||
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