void Start() { foreach (GameObject c in commentators) { c.SetActive(false); } int face = Random.Range(0, commentators.Length); commentators[face].SetActive(true); bool success = SceneVariableManager.score > 50; if (success) { good.SetActive(true); bad.SetActive(false); text.text = successQuotes[Random.Range(0, successQuotes.Length)]; } else { good.SetActive(false); bad.SetActive(true); text.text = failQuotes[Random.Range(0, failQuotes.Length)]; } // Test AudioHandlerScript audioScript = GameObject.Find("AudioHandler")?.GetComponent <AudioHandlerScript>(); audioScript.startNewsHeadMusic(); }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); glow = GameObject.Find("EndGlow").GetComponent <ParticleSystem>(); //Set the fadingAlpha to 1 so that things will fade correctly fadingAlpha = 1; //Find the final level script finalLevelCutscene = GameObject.Find("HallwayRoom1").GetComponent <FinalLevelCutscene> (); //Find the basement room basementRoom = GameObject.Find("EndingBasement"); //Find the silhouette //silhouette = GameObject.Find ("tempSilhouette"); //Find the hunter monster //hunterEnemy = GameObject.FindGameObjectWithTag ("HunterEnemy"); hunterFog = GameObject.Find("FogLeft"); //Get the spotlight for the hunter monster spotlight = GameObject.Find("hunter_spotlight_test_1"); //Make the silhouette invisible //silhouette.GetComponent<Renderer> ().material.color = Color.clear; //Make it inactive until the ending cutscene starts //silhouette.SetActive (false); //find the player player = GameObject.FindGameObjectWithTag("Player"); clickPosition = new Vector2(0f, 0f); }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); sfx = this.GetComponent<AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); anim = this.GetComponent<Animator>(); }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); sfx = this.GetComponent <AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); anim = this.GetComponent <Animator>(); }
void Start() { skipButton.gameObject.SetActive(false); audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); audioHandler.LoopMusic(false); //play credits music audioHandler.PlayMusic(2); StartCoroutine(JumpToStart()); }
void Start() { skipButton.gameObject.SetActive(false); audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); audioHandler.LoopMusic(false); //play credits music audioHandler.PlayMusic(2); StartCoroutine(JumpToStart()); }
void Start() { player = GameObject.Find("Player").GetComponent<PlayerControl>(); itemTextPanel = transform.Find("UICanvas/Overlay/ItemTextPanel").gameObject; // GameObject.Find("ItemTextPanel"); audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); itemTextPanel.SetActive(false); clickPosition = new Vector2(0f, 0f); // cameraScript = Camera.main.GetComponent<CameraFollowScript>(); }
void Start() { player = GameObject.Find("Player").GetComponent <PlayerControl>(); itemTextPanel = transform.Find("UICanvas/Overlay/ItemTextPanel").gameObject; // GameObject.Find("ItemTextPanel"); audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); itemTextPanel.SetActive(false); clickPosition = new Vector2(0f, 0f); // cameraScript = Camera.main.GetComponent<CameraFollowScript>(); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>(); if (Application.loadedLevelName == "Ending Level" || Application.loadedLevelName == "Nightmare") { audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); player.normalSpeed = 0; } startPos = this.transform.position; //move it over based upon level //application.loaded level - 1 gets the levels proper level number (tutorial is lvl 1) //levelOffset += new Vector3((Application.loadedLevel - 1) + 5, 0, 0); //startPos += levelOffset; endPos = startPos + movementDist; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerControl>(); if(Application.loadedLevelName == "Ending Level" || Application.loadedLevelName == "Nightmare") { audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); player.normalSpeed = 0; } startPos = this.transform.position; //move it over based upon level //application.loaded level - 1 gets the levels proper level number (tutorial is lvl 1) //levelOffset += new Vector3((Application.loadedLevel - 1) + 5, 0, 0); //startPos += levelOffset; endPos = startPos + movementDist; }
// Use this for initialization void Start() { audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent <AudioHandlerScript>(); sfx = this.GetComponent <AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); //Grab the spawner and get its script component //obj = GameObject.Find("PatrollingEnemySpawner").GetComponent<PatrollingMonsterSpawner> (); player = GameObject.FindWithTag("Player").GetComponent <PlayerControl>(); playerPos = player.GetComponent <Transform>(); //If the spawner is facing left... //if (!obj.facingRight) //{ //then flip the monsters it spawns to go left // FlipEnemy(); //} }
void Awake() { if (_instance == null) { //If I am the first instance, make me the Singleton _instance = this; DontDestroyOnLoad(this); } else { //If a Singleton already exists and you find //another reference in scene, destroy it! if (this != _instance) { Destroy(this.gameObject); } } }
void Start() { audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent<AudioHandlerScript>(); sfx = this.GetComponent<AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); anim = GetComponent<Animator>(); //set player to the object with tag "Player" player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>(); seconds = 10; //Starts the timer at 10 seconds rand = Random.value* 10; //Generate a random number from 0 to 10 Vector2 currentPos = gameObject.transform.position; //initialize the starting position of linecast every frame startCast = currentPos; //initialize the end position of linecast every frame endCast = currentPos; endCast.y -= lineCastDistance; }
void Start() { audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent <AudioHandlerScript>(); sfx = this.GetComponent <AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); anim = GetComponent <Animator>(); //set player to the object with tag "Player" player = GameObject.FindWithTag("Player").GetComponent <PlayerControl>(); seconds = 10; //Starts the timer at 10 seconds rand = Random.value * 10; //Generate a random number from 0 to 10 Vector2 currentPos = gameObject.transform.position; //initialize the starting position of linecast every frame startCast = currentPos; //initialize the end position of linecast every frame endCast = currentPos; endCast.y -= lineCastDistance; }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); door = GameObject.Find ("DoorLeft"); activated = false; wall = GameObject.Find ("LeftWall"); //hunterEnemy = GameObject.FindGameObjectWithTag ("HunterEnemy"); hunterEnemy.SetActive (false); levelBounds = this.transform.GetComponent<Renderer>().bounds; minY = levelBounds.center.y - levelBounds.extents.y; maxY = levelBounds.center.y + levelBounds.extents.y; player = GameObject.FindGameObjectWithTag ("Player"); cam = Camera.main.gameObject; pause = Camera.main.GetComponent<PauseScript>(); //player.transform.position = new Vector3 (128, player.transform.position.y, 0); playerScript = player.GetComponent<PlayerControl>(); wallMargin = wall.transform.position.x + wallOffset; defaultSpeedTemp = playerScript.defaultSpeed; }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); door = GameObject.Find("DoorLeft"); activated = false; wall = GameObject.Find("LeftWall"); //hunterEnemy = GameObject.FindGameObjectWithTag ("HunterEnemy"); hunterEnemy.SetActive(false); levelBounds = this.transform.GetComponent <Renderer>().bounds; minY = levelBounds.center.y - levelBounds.extents.y; maxY = levelBounds.center.y + levelBounds.extents.y; player = GameObject.FindGameObjectWithTag("Player"); cam = Camera.main.gameObject; pause = Camera.main.GetComponent <PauseScript>(); //player.transform.position = new Vector3 (128, player.transform.position.y, 0); playerScript = player.GetComponent <PlayerControl>(); wallMargin = wall.transform.position.x + wallOffset; defaultSpeedTemp = playerScript.defaultSpeed; }
//public Vector3 originalPosition; void Start() { //spottedCue = GameObject.Find("SpottedIndicator"); // BUGGED NULL REFERENCE anim = this.GetComponent <Animator>(); leftEndPath = GameObject.Find("LeftWall").transform.position.x; rightEndPath = GameObject.Find("RightWall").transform.position.x; //set player to the object with tag "Player" player = GameObject.FindWithTag("Player").GetComponent <PlayerControl>(); //Get Position originalPosition = this.transform.position; originalRotation = this.transform.rotation; // Initialize player distance playerDistance = new Vector2(0f, 0f); //retry restarts movement //speed = 5.0f; audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent <AudioHandlerScript>(); //speed = defaultSpeed; sfx = this.GetComponent <AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); if (player.transform.position.x < gameObject.transform.position.x) { FlipEnemy(); } // set lineOfSight to this objects LineRenderer component and positions //lineOfSight = GetComponent<LineRenderer>(); //lineOfSight.SetPosition(1, new Vector2(lineCastDistance, 0)); // Initialize camera cam = GameObject.FindGameObjectWithTag("MainCamera"); camTransform = cam.GetComponent <Transform> (); }
//GameObject spottedCue; // Use this for initialization void Start() { anim = GetComponent <Animator>(); audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent <AudioHandlerScript>(); sfx = this.GetComponent <AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); speedNormal = speedNormalDefault; speedChasing = speedChasingDefault; //transform.GetComponent<Collider2D>().attachedRigidbody.AddForce(0, 0); //spottedCue.SetActive(false); //set player to the object with tag "Player" player = GameObject.FindWithTag("Player").GetComponent <PlayerControl>(); playerPos = player.GetComponent <Transform>(); //set lineOfSight to this objects LineRenderer component lineOfSight = GetComponent <LineRenderer>(); //set position of end node of line renderer to the same distance as its line cast lineOfSight.SetPosition(1, new Vector3(lineCastDistance, 0, 0)); }
//GameObject retryButton; //GameObject menuButton; //GameObject spottedCue; // Use this for initialization void Start() { Time.timeScale = 1f; // spottedCue = GameObject.Find("SpottedIndicator"); // spottedCue.SetActive(false); player = GameObject.FindWithTag("Player"); playerScript = player.GetComponent <PlayerControl> (); audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); // set the initial position of the player initialPlayerPos = player.transform.position; //only store this if the player is on level 1, 2, or 3 if (Application.loadedLevel >= 3 && Application.loadedLevel <= 5) { openCutscene = GameObject.Find("Cutscene").GetComponent <OpeningCutscene>(); } //only store if final level else if (Application.loadedLevel == 6) { endCutscene = GameObject.Find("HallwayRoom1").GetComponent <FinalLevelCutscene>(); } gameOverPanel = GameObject.Find("GameOverPanel"); //retryButton = GameObject.Find("RetryButton"); //menuButton = GameObject.Find("MenuButton"); gameOverPanel.SetActive(false); overlay.SetActive(false); overlay_image = overlay.GetComponent <Image>(); //play music clip #3 (intro music) /* * audioHandler.LoopMusic(false); * audioHandler.PlayMusic(3); */ //start level music at certain time //StartCoroutine("levelMusic"); }
//GameObject retryButton; //GameObject menuButton; //GameObject spottedCue; // Use this for initialization void Start() { Time.timeScale = 1f; // spottedCue = GameObject.Find("SpottedIndicator"); // spottedCue.SetActive(false); player = GameObject.FindWithTag("Player"); playerScript = player.GetComponent<PlayerControl> (); audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); // set the initial position of the player initialPlayerPos = player.transform.position; //only store this if the player is on level 1, 2, or 3 if (Application.loadedLevel >= 3 && Application.loadedLevel <= 5) { openCutscene = GameObject.Find("Cutscene").GetComponent<OpeningCutscene>(); } //only store if final level else if(Application.loadedLevel == 6) { endCutscene = GameObject.Find("HallwayRoom1").GetComponent<FinalLevelCutscene>(); } gameOverPanel = GameObject.Find("GameOverPanel"); //retryButton = GameObject.Find("RetryButton"); //menuButton = GameObject.Find("MenuButton"); gameOverPanel.SetActive(false); overlay.SetActive(false); overlay_image = overlay.GetComponent<Image>(); //play music clip #3 (intro music) /* audioHandler.LoopMusic(false); audioHandler.PlayMusic(3); */ //start level music at certain time //StartCoroutine("levelMusic"); }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>(); Setup(); StartCoroutine("_Cutscene"); }
// Use this for initialization void Start() { audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent<AudioHandlerScript>(); sfx = this.GetComponent<AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); //Grab the spawner and get its script component //obj = GameObject.Find("PatrollingEnemySpawner").GetComponent<PatrollingMonsterSpawner> (); player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>(); playerPos = player.GetComponent<Transform>(); //If the spawner is facing left... //if (!obj.facingRight) //{ //then flip the monsters it spawns to go left // FlipEnemy(); //} }
//public Vector3 originalPosition; void Start() { //spottedCue = GameObject.Find("SpottedIndicator"); // BUGGED NULL REFERENCE anim = this.GetComponent<Animator>(); leftEndPath = GameObject.Find("LeftWall").transform.position.x; rightEndPath = GameObject.Find("RightWall").transform.position.x; //set player to the object with tag "Player" player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>(); //Get Position originalPosition = this.transform.position; originalRotation = this.transform.rotation; // Initialize player distance playerDistance = new Vector2(0f, 0f); //retry restarts movement //speed = 5.0f; audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent<AudioHandlerScript>(); //speed = defaultSpeed; sfx = this.GetComponent<AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); if (player.transform.position.x < gameObject.transform.position.x) { FlipEnemy(); } // set lineOfSight to this objects LineRenderer component and positions //lineOfSight = GetComponent<LineRenderer>(); //lineOfSight.SetPosition(1, new Vector2(lineCastDistance, 0)); // Initialize camera cam = GameObject.FindGameObjectWithTag ("MainCamera"); camTransform = cam.GetComponent<Transform> (); }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); glow = GameObject.Find("EndGlow").GetComponent<ParticleSystem>(); //Set the fadingAlpha to 1 so that things will fade correctly fadingAlpha = 1; //Find the final level script finalLevelCutscene = GameObject.Find ("HallwayRoom1").GetComponent<FinalLevelCutscene> (); //Find the basement room basementRoom = GameObject.Find ("EndingBasement"); //Find the silhouette //silhouette = GameObject.Find ("tempSilhouette"); //Find the hunter monster //hunterEnemy = GameObject.FindGameObjectWithTag ("HunterEnemy"); hunterFog = GameObject.Find("FogLeft"); //Get the spotlight for the hunter monster spotlight = GameObject.Find ("hunter_spotlight_test_1"); //Make the silhouette invisible //silhouette.GetComponent<Renderer> ().material.color = Color.clear; //Make it inactive until the ending cutscene starts //silhouette.SetActive (false); //find the player player = GameObject.FindGameObjectWithTag ("Player"); clickPosition = new Vector2(0f, 0f); }
// Use this for initialization void Start() { audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>(); Setup(); StartCoroutine("_Cutscene"); }
//GameObject spottedCue; // Use this for initialization void Start() { anim = GetComponent<Animator>(); audioHandler = GameObject.FindGameObjectWithTag("AudioHandler").GetComponent<AudioHandlerScript>(); sfx = this.GetComponent<AudioSource>(); //set volume to player's setting sfx.volume = audioHandler.sfxVolume;//PlayerPrefs.GetFloat("SFX"); speedNormal = speedNormalDefault; speedChasing = speedChasingDefault; //transform.GetComponent<Collider2D>().attachedRigidbody.AddForce(0, 0); //spottedCue.SetActive(false); //set player to the object with tag "Player" player = GameObject.FindWithTag("Player").GetComponent<PlayerControl>(); playerPos = player.GetComponent<Transform>(); //set lineOfSight to this objects LineRenderer component lineOfSight = GetComponent<LineRenderer>(); //set position of end node of line renderer to the same distance as its line cast lineOfSight.SetPosition(1, new Vector3(lineCastDistance, 0, 0)); }