diff --git a/Components/Transform/Drivers/MultiValueArithmeticDriver.cs b/Components/Transform/Drivers/MultiValueArithmeticDriver.cs index ddf8e70..8ec77ca 100644 --- a/Components/Transform/Drivers/MultiValueArithmeticDriver.cs +++ b/Components/Transform/Drivers/MultiValueArithmeticDriver.cs @@ -1,70 +1,69 @@ using System.Linq; -using Elements.Assets; using Elements.Core; using FrooxEngine; namespace Obsidian; +public enum ArithmeticMode +{ + Addition, + Subtraction, + Multiplication, + Division +} + [Category(new string[] { "Obsidian/Transform/Drivers" })] [GenericTypes(GenericTypesAttribute.Group.Primitives)] public class MultiValueArithmeticDriver : Component { - public static bool IsValidGenericType => Coder.SupportsAddSub; - - public enum ArithmeticMode - { - Addition, - Subtraction, - Multiplication, - Division - } + public static bool IsValidGenericType => Coder.SupportsAddSub; - public readonly FieldDrive Target; + public readonly FieldDrive Target; - public readonly Sync Mode; + public readonly Sync Mode; - public readonly SyncList> Values; + public readonly SyncList> Values; - protected override void OnChanges() - { - if (!Target.IsLinkValid || Values.Count == 0) - { - return; - } - if (Values.Contains(Target.Target)) - { - // don't let the component drive itself, don't want a feedback loop - Target.ReleaseLink(); - return; - } - T value = Values[0].Value; - switch (Mode.Value) - { - case ArithmeticMode.Addition: - foreach (Sync sync in Values.Skip(1)) - { - value = Coder.Add(value, sync.Value); - } - break; - case ArithmeticMode.Subtraction: - foreach (Sync sync in Values.Skip(1)) - { - value = Coder.Sub(value, sync.Value); - } - break; - case ArithmeticMode.Multiplication: - foreach (Sync sync in Values.Skip(1)) - { - value = Coder.Mul(value, sync.Value); - } - break; - case ArithmeticMode.Division: - foreach (Sync sync in Values.Skip(1)) - { - value = Coder.Div(value, sync.Value); - } - break; - } - Target.Target.Value = value; - } + protected override void OnChanges() + { + if (!Target.IsLinkValid || Values.Count == 0) + { + return; + } + if (Values.Contains(Target.Target)) + { + // don't let the component drive itself, don't want a feedback loop + Target.ReleaseLink(); + return; + } + T value = Values[0].Value; + switch (Mode.Value) + { + case ArithmeticMode.Addition: + foreach (Sync sync in Values.Skip(1)) + { + value = Coder.Add(value, sync.Value); + } + break; + case ArithmeticMode.Subtraction: + foreach (Sync sync in Values.Skip(1)) + { + value = Coder.Sub(value, sync.Value); + } + break; + case ArithmeticMode.Multiplication: + foreach (Sync sync in Values.Skip(1)) + { + value = Coder.Mul(value, sync.Value); + } + break; + case ArithmeticMode.Division: + foreach (Sync sync in Values.Skip(1)) + { + value = Coder.Div(value, sync.Value); + } + break; + } + Target.Target.Value = value; + } } \ No newline at end of file diff --git a/ProjectObsidian.csproj b/ProjectObsidian.csproj index 49fecf8..8b42581 100644 --- a/ProjectObsidian.csproj +++ b/ProjectObsidian.csproj @@ -12,6 +12,7 @@ C:\Program Files (x86)\Steam\steamapps\common\Resonite\ $(HOME)/.steam/steam/steamapps/common/Resonite/ /mnt/LocalDisk2/SteamLibrary/steamapps/common/Resonite/ + G:\SteamLibrary\steamapps\common\Resonite\