From e72da15af6601a4c959cd04beb290966aa424f46 Mon Sep 17 00:00:00 2001 From: Ethan Cheung Date: Sat, 30 Apr 2022 16:22:25 +0800 Subject: [PATCH] verion 2.0.0 Remove Malimbe references and update Zinnia --- FodyWeavers.xml | 7 - FodyWeavers.xml.meta | 7 - .../Scripts/AverageDirectionExtractor.cs | 16 +- .../SharedResources/Scripts/MoveInPlace.cs | 412 ++++++++++++++---- package.json | 6 +- 5 files changed, 349 insertions(+), 99 deletions(-) delete mode 100644 FodyWeavers.xml delete mode 100644 FodyWeavers.xml.meta diff --git a/FodyWeavers.xml b/FodyWeavers.xml deleted file mode 100644 index fb34420..0000000 --- a/FodyWeavers.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - ^Fight4Dream - - diff --git a/FodyWeavers.xml.meta b/FodyWeavers.xml.meta deleted file mode 100644 index 246bb1e..0000000 --- a/FodyWeavers.xml.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: a84f30a520429ec44ad0af71faf170ca -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Runtime/SharedResources/Scripts/AverageDirectionExtractor.cs b/Runtime/SharedResources/Scripts/AverageDirectionExtractor.cs index 29cd1aa..a7e4929 100644 --- a/Runtime/SharedResources/Scripts/AverageDirectionExtractor.cs +++ b/Runtime/SharedResources/Scripts/AverageDirectionExtractor.cs @@ -1,8 +1,6 @@ namespace Fight4Dream.Locomotors.MoveInPlace.Unity { using System; - using Malimbe.PropertySerializationAttribute; - using Malimbe.XmlDocumentationAttribute; using UnityEngine; using UnityEngine.Events; using Zinnia.Data.Collection.List; @@ -20,12 +18,13 @@ public class AverageDirectionExtractor : Vector3Extractor { } + [Tooltip("Determines whether to extract the local property or the world property.")] + [SerializeField] + private bool useLocal = false; /// /// Determines whether to extract the local property or the world property. /// - [Serialized] - [field: DocumentedByXml] - public bool UseLocal { get; set; } + public bool UseLocal { get => useLocal; set => useLocal = value; } /// /// The direction axes of the transform. @@ -46,12 +45,13 @@ public enum AxisDirection Forward } + [Tooltip("The direction to extract from the Transform.")] + [SerializeField] + private AxisDirection direction = AxisDirection.Forward; /// /// The direction to extract from the . /// - [Serialized] - [field: DocumentedByXml] - public AxisDirection Direction { get; set; } + public AxisDirection Direction { get => direction; set => direction = value; } /// /// Sets the . diff --git a/Runtime/SharedResources/Scripts/MoveInPlace.cs b/Runtime/SharedResources/Scripts/MoveInPlace.cs index 7d55028..cfe71fe 100644 --- a/Runtime/SharedResources/Scripts/MoveInPlace.cs +++ b/Runtime/SharedResources/Scripts/MoveInPlace.cs @@ -1,73 +1,347 @@ namespace Fight4Dream.Locomotors.MoveInPlace.Unity { using Fight4Dream.Tracking.Velocity; - using Malimbe.MemberChangeMethod; - using Malimbe.MemberClearanceMethod; - using Malimbe.PropertySerializationAttribute; using UnityEngine; using Zinnia.Action; using Zinnia.Action.Collection; using Zinnia.Data.Attribute; using Zinnia.Data.Collection.List; using Zinnia.Data.Type.Transformation.Aggregation; + using Zinnia.Extension; using Zinnia.Tracking.Velocity; public class MoveInPlace : MonoBehaviour { public enum EngageMode { AnyEngaged, AllEngaged } - [Serialized] - public EngageMode MoveWhen { get; set; } = EngageMode.AnyEngaged; - [Serialized, Cleared] - public BooleanAction LeftControllerAction { get; set; } - [Serialized, Cleared] - public BooleanAction RightControllerAction { get; set; } - [Serialized, Cleared] - public VelocityTracker LeftControllerVelocityTracker { get; set; } - [Serialized, Cleared] - public VelocityTracker RightControllerVelocityTracker { get; set; } - [Serialized, Cleared] - public GameObjectObservableList ForwardSources { get; set; } - [Serialized, Cleared] - public GameObject Target { get; set; } - [Serialized] - public float SpeedMultiplier { get; set; } = 1f; - [Serialized] - public float SpeedThreshold { get; set; } = 0.1f; - [Serialized] - public float Drag { get; set; } = 1f; - - [Serialized, Cleared] - [field: Header("Reference Settings"), Restricted] - public AnyAction AnyEngaged { get; set; } - [Serialized, Cleared] - [field: Restricted] - public AllAction AllEngaged { get; set; } - [Serialized, Cleared] - [field: Restricted] - public ActionObservableList EngagedControllers { get; set; } - [Serialized, Cleared] - [field: Restricted] - public BooleanAction EngageLeftController { get; set; } - [Serialized, Cleared] - [field: Restricted] - public BooleanAction EngageRightController { get; set; } - [Serialized, Cleared] - [field: Restricted] - public ComponentTrackerProxy LeftControllerProxy { get; set; } - [Serialized, Cleared] - [field: Restricted] - public ComponentTrackerProxy RightControllerProxy { get; set; } - [Serialized, Cleared] - [field: Restricted] - public SpeedChecker SpeedChecker { get; set; } - [Serialized, Cleared] - [field: Restricted] - public FloatMultiplier SetSpeedMultiplier { get; set; } - [Serialized, Cleared] - [field: Restricted] - public ArtificialVelocityApplierProcess MoveTarget { get; set; } - - [CalledAfterChangeOf(nameof(MoveWhen))] + [SerializeField] + private EngageMode moveWhen = EngageMode.AnyEngaged; + public EngageMode MoveWhen + { + get + { + return moveWhen; + } + set + { + moveWhen = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterMoveWhenChange(); + } + } + } + + [SerializeField] + private BooleanAction leftControllerAction = null; + public BooleanAction LeftControllerAction + { + get + { + return leftControllerAction; + } + set + { + leftControllerAction = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterLeftControllerActionChange(); + OnAfterAnyControllerActionChange(); + } + } + } + + [SerializeField] + private BooleanAction rightControllerAction = null; + public BooleanAction RightControllerAction + { + get + { + return rightControllerAction; + } + set + { + rightControllerAction = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterRightControllerActionChange(); + OnAfterAnyControllerActionChange(); + } + } + } + + [SerializeField] + private VelocityTracker leftControllerVelocityTracker = null; + public VelocityTracker LeftControllerVelocityTracker + { + get + { + return leftControllerVelocityTracker; + } + set + { + leftControllerVelocityTracker = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterLeftControllerVelocityTrackerChange(); + } + } + } + + [SerializeField] + private VelocityTracker rightControllerVelocityTracker = null; + public VelocityTracker RightControllerVelocityTracker + { + get + { + return rightControllerVelocityTracker; + } + set + { + rightControllerVelocityTracker = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterRightControllerVelocityTrackerChange(); + } + } + } + + [SerializeField] + private GameObjectObservableList forwardSources = null; + public GameObjectObservableList ForwardSources + { + get + { + return forwardSources; + } + set + { + forwardSources = value; + } + } + + [SerializeField] + private GameObject target = null; + public GameObject Target + { + get + { + return target; + } + set + { + target = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterTargetChange(); + } + } + } + + [SerializeField] + private float speedMultiplier = 1f; + public float SpeedMultiplier + { + get + { + return speedMultiplier; + } + set + { + speedMultiplier = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterSpeedMutiplierChange(); + } + } + } + + [SerializeField] + private float speedThreshold = 0.1f; + public float SpeedThreshold + { + get + { + return speedThreshold; + } + set + { + speedThreshold = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterSpeedThresholdChange(); + } + } + } + + [SerializeField] + private float drag = 1f; + public float Drag + { + get + { + return drag; + } + set + { + drag = value; + if (this.IsMemberChangeAllowed()) + { + OnAfterDragChange(); + } + } + } + + [Header("Reference Settings")] + [Restricted] + [SerializeField] + private AnyAction anyEngaged = null; + public AnyAction AnyEngaged + { + get + { + return anyEngaged; + } + set + { + anyEngaged = value; + } + } + + [Restricted] + [SerializeField] + private AllAction allEngaged = null; + public AllAction AllEngaged + { + get + { + return allEngaged; + } + set + { + allEngaged = value; + } + } + + [Restricted] + [SerializeField] + private ActionObservableList engagedControllers = null; + public ActionObservableList EngagedControllers + { + get + { + return engagedControllers; + } + set + { + engagedControllers = value; + } + } + + [Restricted] + [SerializeField] + private BooleanAction engageLeftController = null; + public BooleanAction EngageLeftController + { + get + { + return engageLeftController; + } + set + { + engageLeftController = value; + } + } + + [Restricted] + [SerializeField] + private BooleanAction engageRightController = null; + public BooleanAction EngageRightController + { + get + { + return engageRightController; + } + set + { + engageRightController = value; + } + } + + [Restricted] + [SerializeField] + private ComponentTrackerProxy leftControllerProxy = null; + public ComponentTrackerProxy LeftControllerProxy + { + get + { + return leftControllerProxy; + } + set + { + leftControllerProxy = value; + } + } + + [Restricted] + [SerializeField] + private ComponentTrackerProxy rightControllerProxy = null; + public ComponentTrackerProxy RightControllerProxy + { + get + { + return rightControllerProxy; + } + set + { + rightControllerProxy = value; + } + } + + [Restricted] + [SerializeField] + private SpeedChecker speedChecker = null; + public SpeedChecker SpeedChecker + { + get + { + return speedChecker; + } + set + { + speedChecker = value; + } + } + + [Restricted] + [SerializeField] + private FloatMultiplier setSpeedMultiplier = null; + public FloatMultiplier SetSpeedMultiplier + { + get + { + return setSpeedMultiplier; + } + set + { + setSpeedMultiplier = value; + } + } + + [Restricted] + [SerializeField] + private ArtificialVelocityApplierProcess moveTarget = null; + public ArtificialVelocityApplierProcess MoveTarget + { + get + { + return moveTarget; + } + set + { + moveTarget = value; + } + } + protected virtual void OnAfterMoveWhenChange() { if (AnyEngaged != null && AllEngaged != null) @@ -77,7 +351,6 @@ protected virtual void OnAfterMoveWhenChange() } } - [CalledAfterChangeOf(nameof(LeftControllerAction))] protected virtual void OnAfterLeftControllerActionChange() { if (EngageLeftController != null) @@ -87,7 +360,6 @@ protected virtual void OnAfterLeftControllerActionChange() } } - [CalledAfterChangeOf(nameof(RightControllerAction))] protected virtual void OnAfterRightControllerActionChange() { if (EngageRightController != null) @@ -97,8 +369,6 @@ protected virtual void OnAfterRightControllerActionChange() } } - [CalledAfterChangeOf(nameof(LeftControllerAction))] - [CalledAfterChangeOf(nameof(RightControllerAction))] protected virtual void OnAfterAnyControllerActionChange() { if (EngagedControllers != null) @@ -115,7 +385,6 @@ protected virtual void OnAfterAnyControllerActionChange() } } - [CalledAfterChangeOf(nameof(LeftControllerVelocityTracker))] protected virtual void OnAfterLeftControllerVelocityTrackerChange() { if (LeftControllerProxy != null) @@ -131,7 +400,6 @@ protected virtual void OnAfterLeftControllerVelocityTrackerChange() } } - [CalledAfterChangeOf(nameof(RightControllerVelocityTracker))] protected virtual void OnAfterRightControllerVelocityTrackerChange() { if (RightControllerProxy != null) @@ -147,16 +415,14 @@ protected virtual void OnAfterRightControllerVelocityTrackerChange() } } - [CalledAfterChangeOf(nameof(SpeedThreshold))] - protected virtual void OnAfterSpeedThresholdChange() + protected virtual void OnAfterTargetChange() { - if (SpeedChecker != null) + if (MoveTarget != null) { - SpeedChecker.SpeedThreshold = SpeedThreshold; + MoveTarget.Target = Target; } } - [CalledAfterChangeOf(nameof(SpeedMultiplier))] protected virtual void OnAfterSpeedMutiplierChange() { if (SetSpeedMultiplier != null) @@ -165,16 +431,14 @@ protected virtual void OnAfterSpeedMutiplierChange() } } - [CalledAfterChangeOf(nameof(Target))] - protected virtual void OnAfterTargetChange() + protected virtual void OnAfterSpeedThresholdChange() { - if (MoveTarget != null) + if (SpeedChecker != null) { - MoveTarget.Target = Target; + SpeedChecker.SpeedThreshold = SpeedThreshold; } } - [CalledAfterChangeOf(nameof(Drag))] protected virtual void OnAfterDragChange() { if (MoveTarget != null) @@ -191,9 +455,9 @@ protected virtual void OnEnable() OnAfterAnyControllerActionChange(); OnAfterLeftControllerVelocityTrackerChange(); OnAfterRightControllerVelocityTrackerChange(); - OnAfterSpeedThresholdChange(); - OnAfterSpeedMutiplierChange(); OnAfterTargetChange(); + OnAfterSpeedMutiplierChange(); + OnAfterSpeedThresholdChange(); OnAfterDragChange(); if (LeftControllerProxy != null) { diff --git a/package.json b/package.json index 038dec9..d7ca924 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.fight4dream.locomotors.moveinplace.unity", "displayName": "FIGHT4DREAM Locomotors.MoveInPlace.Unity", "description": "Activate and swing the controllers to move.", - "version": "1.5.0", + "version": "2.0.0", "unity": "2018.3", "unityRelease": "10f1", "keywords": [ @@ -23,8 +23,8 @@ "url": "https://www.fight4dream.com" }, "dependencies": { - "io.extendreality.zinnia.unity": "1.27.0", - "com.fight4dream.zinnia.speedchecker.unity": "1.2.2" + "io.extendreality.zinnia.unity": "2.0.0", + "com.fight4dream.zinnia.speedchecker.unity": "2.0.0" }, "files": [ "*.md",