Skip to content

Commit

Permalink
fix(Facade): use extension method to set enum value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
extendreality committed Jul 11, 2020
1 parent 5750b37 commit f68fcfb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Runtime/SharedResources/Scripts/PointerFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Zinnia.Action;
using Zinnia.Cast;
using Zinnia.Data.Attribute;
using Zinnia.Extension;
using Zinnia.Pointer;
using Zinnia.Rule;

Expand Down Expand Up @@ -119,7 +120,7 @@ public enum SelectionType
/// <param name="selectionMethodIndex">The index of the <see cref="SelectionType"/>.</param>
public virtual void SetSelectionMethod(int selectionMethodIndex)
{
SelectionMethod = (SelectionType)Mathf.Clamp(selectionMethodIndex, 0, System.Enum.GetValues(typeof(SelectionType)).Length);
SelectionMethod = EnumExtensions.GetByIndex<SelectionType>(selectionMethodIndex);
}

/// <summary>
Expand Down

0 comments on commit f68fcfb

Please sign in to comment.