public void Play() { GetComponent <AudioSource>().Play(); characterSelect.gameObject.SetActive(false); currentInteractable = null; background.gameObject.SetActive(false); ItemSpawner.Instance.gameObject.SetActive(true); }
public void PlayerWon(RobotType type) { source.Stop(); source.clip = winMusic; source.Play(); playerWon.gameObject.SetActive(true); currentInteractable = playerWon.gameObject.GetComponent <IUIInteractable>(); GetComponentInChildren <PlayerWinsUI>().Display(type); }
private void Start() { Instance = this; ItemSpawner.Instance.gameObject.SetActive(false); currentInteractable = characterSelect.gameObject.GetComponent <IUIInteractable>(); characterSelect.gameObject.SetActive(true); background = transform.Find("Image").GetComponent <Image>(); selectImage.gameObject.SetActive(true); }
/// <summary>Register an Interactable with the UI system. Calling this will enable it to start interacting with UI.</summary> /// <param name="interactable">The IUIInteractable to use.</param> public void RegisterInteractable(IUIInteractable interactable) { EnsureInitialized(); for (int i = 0; i < m_RegisteredInteractables.Count; i++) { if (m_RegisteredInteractables[i].interactable == interactable) { return; } } m_RegisteredInteractables.Add(new RegisteredInteractable(interactable, m_RollingInteractableIndex++)); }
/// <summary>Unregisters an Interactable with the UI system. This cancels all UI Interaction and makes the IUIInteractable no longer able to affect UI.</summary> /// <param name="interactable">The IUIInteractable to stop using.</param> public void UnregisterInteractable(IUIInteractable interactable) { EnsureInitialized(); for (int i = 0; i < m_RegisteredInteractables.Count; i++) { if (m_RegisteredInteractables[i].interactable == interactable) { RegisteredInteractable registeredInteractable = m_RegisteredInteractables[i]; registeredInteractable.interactable = null; m_RegisteredInteractables[i] = registeredInteractable; return; } } }
/// <summary>Retrieves the UI Model for a selected Interactable.</summary> /// <param name="interactable">The Interactable you want the model for.</param> /// <param name="model">The returned model that reflects the UI state of the interactable.</param> /// <returns>True if the model was able to retrieved, false otherwise.</returns> public bool GetTrackedDeviceModel(IUIInteractable interactable, out TrackedDeviceModel model) { EnsureInitialized(); for (int i = 0; i < m_RegisteredInteractables.Count; i++) { if (m_RegisteredInteractables[i].interactable == interactable) { model = m_RegisteredInteractables[i].model; return(true); } } model = new TrackedDeviceModel(-1); return(false); }
public RegisteredInteractable(IUIInteractable interactable, int deviceIndex) { this.interactable = interactable; model = new TrackedDeviceModel(deviceIndex); }
public void Add(IUIInteractable interactable) { this.m_Elements.Add(interactable); this.m_Interactables.Add(interactable); }