From f68fcfb051f55312d56467a94b4798fe0a0b26d7 Mon Sep 17 00:00:00 2001 From: extendreality Date: Sat, 11 Jul 2020 15:09:26 +0100 Subject: [PATCH] fix(Facade): use extension method to set enum value The SetSelectionMethod method now uses the Zinnia EnumExtensions helper method to set the value of the enum by the index instead of repeating the same logic. --- Runtime/SharedResources/Scripts/PointerFacade.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Runtime/SharedResources/Scripts/PointerFacade.cs b/Runtime/SharedResources/Scripts/PointerFacade.cs index c4ea56e..074ccf8 100644 --- a/Runtime/SharedResources/Scripts/PointerFacade.cs +++ b/Runtime/SharedResources/Scripts/PointerFacade.cs @@ -9,6 +9,7 @@ using Zinnia.Action; using Zinnia.Cast; using Zinnia.Data.Attribute; + using Zinnia.Extension; using Zinnia.Pointer; using Zinnia.Rule; @@ -119,7 +120,7 @@ public enum SelectionType /// The index of the . public virtual void SetSelectionMethod(int selectionMethodIndex) { - SelectionMethod = (SelectionType)Mathf.Clamp(selectionMethodIndex, 0, System.Enum.GetValues(typeof(SelectionType)).Length); + SelectionMethod = EnumExtensions.GetByIndex(selectionMethodIndex); } ///