예제 #1
0
        public virtual void SetPosePosition(string name, Vector3 position)
        {
            if (!m_VirtualPoses.ContainsKey(name))
            {
                AddPose(name);
            }
            VirtualPose pose = m_VirtualPoses[name];

            pose.position = position;
        }
예제 #2
0
        public virtual void SetPoseRotation(string name, Quaternion rotation)
        {
            if (!m_VirtualPoses.ContainsKey(name))
            {
                AddPose(name);
            }
            VirtualPose pose = m_VirtualPoses[name];

            pose.rotation = rotation;
        }
        // returns a reference to a named virtual button.
        public static VirtualPose VirtualPoseReference(object caller, string name, bool canAdd = false)
        {
            VirtualPose item = null;

            if (PoseExists(name))
            {
                item = VirtualPoseReference(name);
            }
            else
            {
                RegisterVirtualPose(item = new VirtualPose(name));
            }
            if (item != null)
            {
                item.AddRef(caller);
            }
            return(item);
        }
예제 #4
0
        public virtual void RegisterVirtualPose(VirtualPose pose)
        {
            // check if already have a buttin with that name and log an error if we do
            if (m_VirtualPoses.ContainsKey(pose.name))
            {
                Debug.LogError("There is already a virtual pose named " + pose.name + " registered.");
            }
            else
            {
                // add any new poses
                m_VirtualPoses.Add(pose.name, pose);

                // if we dont want to match to the input manager then always use a virtual axis
                if (!pose.matchWithInputManager)
                {
                    m_AlwaysUseVirtual.Add(pose.name);
                }
            }
        }
예제 #5
0
        public virtual void InitInput(string fmtAxis, string[] axes, string fmtButton, string[] buttons, string poseName)
        {
            int i, imax;

            //
            i      = 0; imax = axes.Length;
            m_Axes = new VirtualAxis[imax]; m_MapAxes = new Dictionary <string, VirtualAxis>(imax);
            for (; i < imax; ++i)
            {
                m_Axes[i] = CrossInputManager.VirtualAxisReference(this, string.Format(fmtAxis, axes[i]), true);
                m_MapAxes.Add(axes[i], m_Axes[i]);               // Add the raw input name.
            }
            //
            i         = 0; imax = buttons.Length;
            m_Buttons = new VirtualButton[imax]; m_MapButtons = new Dictionary <string, VirtualButton>(imax);
            for (; i < imax; ++i)
            {
                m_Buttons[i] = CrossInputManager.VirtualButtonReference(this, string.Format(fmtButton, buttons[i]), true);
                m_MapButtons.Add(buttons[i], m_Buttons[i]);               // Add the raw input name.
            }
            //
            pose = CrossInputManager.VirtualPoseReference(this, poseName, true);
        }
 /// <summary>
 ///
 /// </summary>
 public static void RegisterVirtualPose(VirtualPose pose)
 {
     activeInput.RegisterVirtualPose(pose);
 }