// Use this for initialization void Start() { // initialize selectors allSelectors = new List <SingleSelector>(); for (int i = 0; i < 4; i++) { GameObject newSelector = Instantiate(singleSelectorOriginal.gameObject) as GameObject; newSelector.transform.parent = singleSelectorOriginal.transform.parent; newSelector.transform.localScale = singleSelectorOriginal.transform.localScale; SingleSelector newSelectorScript = newSelector.GetComponent <SingleSelector>(); newSelectorScript.Initialize(i, this); newSelectorScript.Hide(); allSelectors.Add(newSelectorScript); } singleSelectorOriginal.gameObject.SetActive(false); // collect possible input devices potentialInputDevices = new List <InputDevice>(); potentialInputDevices.Add(new KeyboardInputDevice(0)); potentialInputDevices.Add(new KeyboardInputDevice(1)); for (int i = 1; i <= 4; i++) { potentialInputDevices.Add(new XBox360InputDevice(i)); } inputsInUse = new List <InputDevice>(); }
/// <summary> /// Execute the selection algorithm, returning one result. /// </summary> public T Select() { CalculateCumulativeWeights(); var Selector = new SingleSelector <T>(this); return(Selector.Select()); }
internal void RemovePlayer(SingleSelector selector) { potentialInputDevices.Add(selector.GetInput()); inputsInUse.Remove(selector.GetInput()); selector.Hide(); }
internal void RemovePlayer(SingleSelector selector) { potentialInputDevices.Add(selector.GetInput()); inputsInUse.Remove(selector.GetInput()); selector.Hide(); }