public static PlayerDeviceAssignment GetAssignment(this InputDevice inputDevice)
        {
            PlayerDeviceAssignment assignment = null;

            s_Assignments.TryGetValue(inputDevice, out assignment);
            return(assignment);
        }
 public static void SetAssignment(this InputDevice inputDevice, PlayerDeviceAssignment assignment)
 {
     if (assignment == null)
     {
         if (s_Assignments.ContainsKey(inputDevice))
         {
             s_Assignments.Remove(inputDevice);
         }
     }
     else
     {
         s_Assignments[inputDevice] = assignment;
     }
 }
示例#3
0
        public bool AssignDevice(InputDevice device)
        {
            if (device.GetAssignment() != null)
            {
                // If already assigned to this player, accept as success. Otherwise, fail.
                if (device.GetAssignment().player == this)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            var assignment = new PlayerDeviceAssignment(this, device);

            assignment.Assign();

            return(true);
        }