void OnMouseOver() { if (!DialRotation.DialLocked() && channels.TalkingToWeedman) { SetMaterial(hoverMaterial); } }
void OnMouseDown() { Debug.Log(this.name + " clicked"); if (!DialRotation.DialLocked() && channels.TalkingToWeedman) { areaTracker.DisableAllAreas(); selected = true; SetMaterial(selectedMaterial); areaTracker.SetLeafPosition(this.gameObject.transform.position.x, this.gameObject.transform.position.y); channels.InterruptWeedman(); //TODO move Van here, if it's not here already List <AreaController> areas = areaTracker.areas; GameManager.Instance.gameStateMachine.MoveWeedVan(areas.IndexOf(this)); } }
// Update is called once per frame void Update() { bool dialMoving = Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D); bool radioOffOrIntroPlaying = GameManager.Instance.gameStateMachine.currentState == StateType.Off || GameManager.Instance.gameStateMachine.currentState == StateType.Intro; int currentChannel = ReturnChannel(DialRotation.GetFrequency()); if (!DialRotation.DialLocked()) { handleTuningSound(dialMoving); } if (currentChannel >= 0) { //Dial can hear a radio station radioChannels[currentChannel].volume += VOL_DELTA; if (currentChannel - 1 >= 0) { radioChannels[currentChannel - 1].volume -= VOL_DELTA; } if (currentChannel + 1 < radioChannels.Length) { radioChannels[currentChannel + 1].volume -= VOL_DELTA; } if (RadioStatic.volume > 0) { RadioStatic.volume -= VOL_DELTA; } //Switched AWAY from WEEDMAN_CHANNEL if (currentChannel != WEEDMAN_CHANNEL) { loopWeedmanRants = true; TalkingToWeedman = false; weedAlert.StopWeedAlarm(); } } else { //In between channels, play static if (RadioStatic.volume < 0.5) { RadioStatic.volume += VOL_DELTA; } // and make stations quiet foreach (AudioSource radioChannel in radioChannels) { if (radioChannel.volume > 0) { radioChannel.volume -= VOL_DELTA; } } weedAlert.StopWeedAlarm(); } //Switched TO WEEDMAN_CHANNEL if (currentChannel == WEEDMAN_CHANNEL) { //TODO: check if a pin was placed/button was pressed and give a stock response. radioChannels[WEEDMAN_CHANNEL].volume += VOL_DELTA; TalkingToWeedman = true; if (!radioOffOrIntroPlaying) { weedAlert.StartWeedAlarm(); } } //Check for weedman rant loops if (loopWeedmanRants && !radioChannels[WEEDMAN_CHANNEL].isPlaying) { changeWeedmanLoopIndex(); } //Police channels if (GameManager.Instance.gameStateMachine.currentState == StateType.Playing) { for (int p = 0; p < TOTAL_POLICE_CHANNELS; p++) { if (!radioChannels[p].isPlaying) { AdvancePoliceIndex(p); } } } }