public void OnPolice() { if (ClearCheck(UIState.Police)) { police.SetHighlight(true); currentState = UIState.Police; } }
public void SetAllChildrenHighlightable(bool highlight) { mChildrenRenderers = gameObject.GetComponentsInChildren <Renderer>(); if (mChildrenRenderers != null) { foreach (Renderer render in mChildrenRenderers) { Highlightable highlightScript = GetComponent <Highlightable>(); if (highlightScript == null) { highlightScript = render.gameObject.AddComponent <Highlightable>(); } highlightScript.SetHighlight(highlight); } } }
// Update is called once per frame void Update() { if (Time.timeScale == 0) { if ((LeftRight <= -0.7) || (LeftRightAlt <= -0.7) || (Input.GetKeyDown(KeyCode.LeftArrow))) { if (!hasExecuted) { isResume = !isResume; resume.SetHighlight(isResume); back.SetHighlight(!isResume); hasExecuted = true; } } else if ((LeftRight >= 0.7) || (LeftRightAlt >= 0.7) || (Input.GetKeyDown(KeyCode.RightArrow))) { if (!hasExecuted) { isResume = !isResume; resume.SetHighlight(isResume); back.SetHighlight(!isResume); hasExecuted = true; } } else { hasExecuted = false; } if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown("joystick 1 button 9") || Input.GetKeyDown("joystick 2 button 9") || Input.GetKeyDown("joystick 3 button 9") || Input.GetKeyDown("joystick 1 button 7") || Input.GetKeyDown("joystick 2 button 7") || Input.GetKeyDown("joystick 3 button 7")) { if (isResume) { MessagingManager.Broadcast(Messages.RESUME, this.gameObject); } else { Resume(); Application.LoadLevel("MainMenuTest"); } } } else if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown("joystick 1 button 9") || Input.GetKeyDown("joystick 2 button 9") || Input.GetKeyDown("joystick 3 button 9") || Input.GetKeyDown("joystick 1 button 7") || Input.GetKeyDown("joystick 2 button 7") || Input.GetKeyDown("joystick 3 button 7")) { MessagingManager.Broadcast(Messages.PAUSE, this.gameObject); isResume = true; back.SetHighlight(!isResume); resume.SetHighlight(isResume); } if ((useTimer) && (Time.time > targetTime)) { if (player1Victory || player2Victory) { Application.LoadLevel("MainMenuTest"); } RestartGame(); } }