public RGCtrolState(TRole role)
            {
                var info = ViveRoleEnum.GetInfo <TRole>();

                m_state = GetState(typeof(TRole), info.ToRoleValue(role));
                m_role  = role;
            }
        private static ICtrlState GetState(Type roleType, int roleValue)
        {
            Initialize();
            var info = ViveRoleEnum.GetInfo(roleType);

            if (!info.IsValidRoleValue(roleValue))
            {
                return(s_defaultState);
            }

            ICtrlState[] stateList;
            if (!s_roleStateTable.TryGetValue(roleType, out stateList) || stateList == null)
            {
                s_roleStateTable[roleType] = stateList = new ICtrlState[info.ValidRoleLength];
            }

            var roleOffset = info.ToRoleOffset(roleValue);

            if (stateList[roleOffset] == null)
            {
                stateList[roleOffset] = new RCtrlState(roleType, roleValue);
            }

            return(stateList[roleOffset]);
        }
 protected override void Start()
 {
     base.Start();
     m_stateCtrl = new CtrlStateEntry();
 }
 private void SetState <T>() where T : ICtrlState, new()
 {
     m_stateCtrl = new T();
     m_stateCtrl.OnAwake(this);
 }