// Update is called once per frame void Update() { /* * layerOn = DJ_Util.isLayerOn(gameObject.GetComponent<DJ_BeatActivation>()); * if (layerOn) * { * gameObject.GetComponent<MeshRenderer>().enabled = true; * gameObject.GetComponent<BoxCollider>().enabled = true; * } * * onBeat = DJ_Util.activateWithNoSound(gameObject.GetComponent<DJ_BeatActivation>()); */ onBeat = DJ_Util.activateWithSound(gameObject.GetComponent <DJ_BeatActivation>()); if (onBeat) { if (gameObject.GetComponent <Collider>().enabled) { gameObject.GetComponent <Collider>().enabled = false; gameObject.GetComponent <Renderer>().material = safeShader; //gameObject.renderer.material } else { gameObject.GetComponent <Collider>().enabled = true; gameObject.GetComponent <Renderer>().material = dangerShader; } } }
// Update is called once per frame void Update() { // spring activates on beat onBeat = DJ_Util.activateWithSound(gameObject.GetComponent <DJ_BeatActivation>()); if (onBeat) { _flipper.Flip(); DJ_Point tilePos = new DJ_Point(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.z)); if (DJ_TileManagerScript.tileMap.ContainsKey(tilePos)) { if (DJ_PlayerManager.playerTilePos.X == tilePos.X && DJ_PlayerManager.playerTilePos.Y == tilePos.Y && !DJ_PlayerManager.player.GetComponent <DJ_Movement>().isLerping) { DJ_PlayerManager.player.GetComponent <DJ_Movement>().heightOfHop = height; DJ_PlayerManager.player.GetComponent <DJ_Movement>().direction = direction; DJ_PlayerManager.player.GetComponent <DJ_Movement>().maxMoveDistance = distance; DJ_PlayerManager.player.GetComponent <DJ_Movement>().canMove = true; } } gameObject.GetComponentInChildren <MeshRenderer>().GetComponent <Renderer>().material = dangerShader; } else { gameObject.GetComponentInChildren <MeshRenderer>().GetComponent <Renderer>().material = safeShader; } }
// Update is called once per frame void Update() { /* * layerOn = DJ_Util.isLayerOn(gameObject.GetComponent<DJ_BeatActivation>()); * if (layerOn) * { * gameObject.GetComponent<MeshRenderer>().enabled = true; * gameObject.GetComponent<BoxCollider>().enabled = true; * } * onBeat = DJ_Util.activateWithNoSound(gameObject.GetComponent<DJ_BeatActivation>()); */ if (_activationScript.instrument1) { fadeOutSpeed = DJ_BeatManager.GetNextLayerOneOn();; } if (_activationScript.instrument2) { fadeOutSpeed = DJ_BeatManager.GetNextLayerTwoOn();; } if (_activationScript.instrument3) { fadeOutSpeed = DJ_BeatManager.GetNextLayerThreeOn();; } if (_activationScript.instrument4) { fadeOutSpeed = DJ_BeatManager.GetNextLayerFourOn();; } onBeat = DJ_Util.activateWithSound(gameObject.GetComponent <DJ_BeatActivation>()); if (onBeat) { gameObject.GetComponent <Renderer>().material.SetFloat("_Alpha", 1); gameObject.GetComponent <Renderer>().material.SetFloat("_GlowStrength", 2); //goes to target when it reaches its target then shrink HOTween.To(transform, .2f, target.OnComplete(Shrink)); retracting = false; //gameObject.renderer.material = dangerShader; } if (fadeOut) { currAlpha = gameObject.GetComponent <Renderer>().material.GetFloat("_Alpha"); lerpA = Mathf.Lerp(currAlpha, fadeOutAlpha, fadeOutSpeed * Time.deltaTime); currGlowStrength = gameObject.GetComponent <Renderer>().material.GetFloat("_GlowStrength"); lerpG = Mathf.Lerp(currGlowStrength, fadeOutGlow, fadeOutSpeed * Time.deltaTime); gameObject.GetComponent <Renderer>().material.SetFloat("_Alpha", lerpA); gameObject.GetComponent <Renderer>().material.SetFloat("_GlowStrength", lerpG); } }
// Update is called once per frame void Update() { // Used for instant teleporting in the level select if (instantTeleport) { DJ_Point tilePos = new DJ_Point(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.z)); if (DJ_TileManagerScript.tileMap.ContainsKey(tilePos)) { if (DJ_PlayerManager.playerTilePos.X == tilePos.X && DJ_PlayerManager.playerTilePos.Y == tilePos.Y && !DJ_PlayerManager.player.GetComponent <DJ_Movement>().isLerping) { if (!(DJ_PlayerManager.player.GetComponent <DJ_Movement>().prevPrevTilePos.X == teleporter.gameObject.transform.position.x && DJ_PlayerManager.player.GetComponent <DJ_Movement>().prevPrevTilePos.Y == teleporter.gameObject.transform.position.z)) { DJ_PlayerManager.player.GetComponent <DJ_Movement>().direction = DJ_Dir.TP; DJ_PlayerManager.player.GetComponent <DJ_Movement>().targetTilePos.X = Mathf.RoundToInt(teleporter.gameObject.transform.position.x); DJ_PlayerManager.player.GetComponent <DJ_Movement>().targetTilePos.Y = Mathf.RoundToInt(teleporter.gameObject.transform.position.z); DJ_PlayerManager.player.GetComponent <DJ_Movement>().heightOfHop = 14; } } } } // Used for teleporting during gameplay else { onBeat = DJ_Util.activateWithSound(gameObject.GetComponent <DJ_BeatActivation>()); if (onBeat) { DJ_Point tilePos = new DJ_Point(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.z)); if (DJ_TileManagerScript.tileMap.ContainsKey(tilePos)) { if (DJ_PlayerManager.playerTilePos.X == tilePos.X && DJ_PlayerManager.playerTilePos.Y == tilePos.Y && !DJ_PlayerManager.player.GetComponent <DJ_Movement>().isLerping) { DJ_PlayerManager.player.GetComponent <DJ_Movement>().direction = DJ_Dir.TP; DJ_PlayerManager.player.GetComponent <DJ_Movement>().targetTilePos.X = Mathf.RoundToInt(teleporter.gameObject.transform.position.x); DJ_PlayerManager.player.GetComponent <DJ_Movement>().targetTilePos.Y = Mathf.RoundToInt(teleporter.gameObject.transform.position.z); DJ_PlayerManager.player.GetComponent <DJ_Movement>().heightOfHop = 8; } } } } }