// Update is called once per frame void Update() { if (state == RhythmUI.arrowState.normal) { Vector3 destination = this.gameObject.transform.localPosition; float currentBeat = parentUI.timeToBeat(Time.time); destination.y = 208f - 64f * (beat - currentBeat); this.gameObject.transform.localPosition = destination; if (destination.y > 272) Destroy(this.gameObject); } else { if (state == RhythmUI.arrowState.ClearGood) { float scale = 1 + ((Time.time - stateOffset) / clearTime); this.gameObject.transform.localScale = new Vector3(scale, scale, 1f); } float transparancy = 1 - ((Time.time - stateOffset) / clearTime); byte alpha = (byte) Mathf.FloorToInt(255f * transparancy); this.gameObject.GetComponent<Image>().material.SetColor("_Color", new Color32(255, 255, 255, alpha)); if (Time.time - stateOffset > clearTime) Destroy(this.gameObject); } }
// Update is called once per frame void Update() { if (checks >= 5) { dm.EnablePressSpaceText(); } if (replayMode) { if (replayFrameNumber < replayQueue.Count && rhythmUI.timeToBeat(Time.time) > replayQueue[replayFrameNumber].beat) { cluck = replayQueue[replayFrameNumber].cluck; nextDirection = replayQueue[replayFrameNumber].nextDirection; replayFrameNumber++; } } else { if (cluck || nextDirection != GameDirection.none) { replayFrame frameData = new replayFrame(); frameData.beat = rhythmUI.timeToBeat(Time.time); frameData.cluck = cluck; frameData.nextDirection = nextDirection; replayQueue.Add(frameData); if (cluck) { if (Random.value < .5) { audio.PlayOneShot(squawk1); } else { audio.PlayOneShot(squawk2); } } if (nextDirection == GameManager.GameDirection.chicken) { if (Random.value < .5) { audio.PlayOneShot(clucks1); } else { audio.PlayOneShot(clucks2); } } } } if (datingSimMode == true) { dm.cluck = cluck; cluck = false; dm.nextDirection = nextDirection; nextDirection = GameDirection.none; return; } if (cluck) { Debug.Log("cluck check"); annoyedNPC = true; questionMark.Appear(); cluck = false; } if (nextDirection != GameDirection.none) { checks++; if (nextDirection == GameDirection.romance || nextDirection == GameDirection.chicken || annoyedNPC) { SwitchToDatingSimMode(); } if (nextDirection == GameDirection.spy) { switch (checks) { case 1: //move to cubicle spyMusic.volume = 1f; romanceMusic.volume = 0f; playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(1, 3)); playerController.pushAction(PlayerController.Movement.action.crouchRight, 5); playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(1, 4)); playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(2, 4)); playerController.pushAction(PlayerController.Movement.action.crouchRight, 5); break; case 2: // duck behind file cabinet playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(3, 4)); playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(3, 3)); playerController.pushAction(PlayerController.Movement.action.move, 4, new Vector2(5, 3)); playerController.pushAction(PlayerController.Movement.action.crouchLeft, 5); break; case 3: // move to other cubicle playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(4, 3)); playerController.pushAction(PlayerController.Movement.action.move, 4, new Vector2(4, 1)); playerController.pushAction(PlayerController.Movement.action.move, 4, new Vector2(5, 1)); playerController.pushAction(PlayerController.Movement.action.crouchLeft, 5); break; case 4: //duck behind potted plant playerController.pushAction(PlayerController.Movement.action.move, 6, new Vector2(2, 1)); playerController.pushAction(PlayerController.Movement.action.wait, .5f); playerController.pushAction(PlayerController.Movement.action.move, 1, new Vector2(4, 1)); playerController.pushAction(PlayerController.Movement.action.move, .5f, new Vector2(4, 0)); playerController.pushAction(PlayerController.Movement.action.crouchLeft, 1); break; case 5: //move to file cabinet playerController.pushAction(PlayerController.Movement.action.move, 2, new Vector2(4, 1)); playerController.pushAction(PlayerController.Movement.action.move, 1.5f, new Vector2(0, 1)); playerController.pushAction(PlayerController.Movement.action.crouchRight, 0); break; } } nextDirection = GameDirection.none; } }