void OnMouseDown() { buttonlight.ChangeMat(); light.SetActive(false); //FindObjectOfType<ChangeText>().RoomLight.TurnOff(); screenText.text = ""; StartCoroutine(EndCoroutine()); }
void OnMouseDown() { if ((light.transform.position - player.transform.position).sqrMagnitude < 1 && !turnedOn) { turnedOn = true; buttonlight.ChangeMat(); light.SetActive(true); FindObjectOfType <ChangeText>().RoomLight.TurnOn(); screenText.text = ">>Debug mode activated\n>>AI Supervisor initiated\n>>Please press Left Mouse Button to Continue..."; turningOn.Play(); buzz.Play(); } else if (turnedOn) { buttonlight.ChangeMat(); light.SetActive(false); FindObjectOfType <ChangeText>().RoomLight.TurnOff(); screenText.text = ""; StartCoroutine(EndCoroutine()); } }
/* * / Build selected pipe, returns if successul */ private bool buildPipe() { if (nextPipe.GetComponent <Identifier>().pipeType == Identifier.PipeType.Outlet && !ventGoal.bounds.Contains(nextPipe.transform.position)) { Debug.Log("Not allowed to build here"); return(false); } ChangeMaterial pipeToChange = nextPipe.GetComponentInChildren(typeof(ChangeMaterial)) as ChangeMaterial; pipeToChange.ChangeMat(); GameObject builtPipe = nextPipe; pipeHistory.Add(builtPipe); foreach (GameObject pipe in currentSelection) { if (!pipe.activeSelf) { Destroy(pipe); } } currentSelection.Clear(); PipeSound.Instance.PlayPipeConnectSound(builtPipe.transform); updateCamera(); // Determine jump length based on built pipe type switch (builtPipe.GetComponent <Identifier>().pipeType) { case Identifier.PipeType.Long: jumpLength = -1.25f; break; case Identifier.PipeType.Medium: jumpLength = -0.88f; //Debug.Log("medium"); break; case Identifier.PipeType.Short: jumpLength = -0.50f; //Debug.Log("medium"); break; case Identifier.PipeType.Left: jumpLength = -0.18f; bendDir = 1; //Debug.Log("left"); break; case Identifier.PipeType.Right: jumpLength = -0.18f; bendDir = 2; //Debug.Log("right"); break; case Identifier.PipeType.T: jumpLength = -0.25f; //Debug.Log("t"); break; case Identifier.PipeType.Outlet: jumpLength = -0.30f; if (!ventGoal.getComplete() && ventGoal.bounds.Contains(builtPipe.transform.position)) { ventGoal.setComplete(true); completed = true; showObjs(endUI, true); } break; } return(true); }