private void FixedUpdate() { PlaySounds pse = GetComponent <PlaySounds>(); if (Input.GetKeyDown(zoomKey) && mainCam.fieldOfView > zoomFOV) { pse.PlaySFX(0); } else if (Input.GetKeyUp(zoomKey) && mainCam.fieldOfView > zoomFOV) { pse.PlaySFX(1); } // adjust fov based on zoom speed to create a zoom in/ out effect if (Input.GetKey(zoomKey) && mainCam.fieldOfView > zoomFOV) { mainCam.fieldOfView = mainCam.fieldOfView - zoomSpeed; isZoomedIn = true; } else if (!Input.GetKey(zoomKey) && mainCam.fieldOfView < normalFOV) { mainCam.fieldOfView = mainCam.fieldOfView + zoomSpeed; isZoomedIn = false; } }
// Update is called once per frame void Update() { if (player.GetComponent <RailMovement>().location == player.GetComponent <RailManager>().location24) { PlaySounds ps = GetComponent <PlaySounds>(); ps.PlaySFX(0); myAnim.Play("Rise"); } }
public void LoadScene(string sName) // loads scene based on name { SceneManager.LoadScene(sName); PlaySounds ps = GetComponent <PlaySounds>(); if (GetSceneName() == "TitleScreen" || sName == "TitleScreen") { ps.PlaySFX(0); } if (GetSceneName() == "HighScore Scene" || sName == "HighScore Scene") { ps.PlaySFX(2); } if (GetSceneName() == "CourseGameplay" || sName == "CourseGameplay") { ps.PlaySFX(1); } }
public void LoadScene(int num) // loads scene based on number { SceneManager.LoadScene(num); PlaySounds ps = GetComponent <PlaySounds>(); if (GetSceneName() == "TitleScreen") { ps.PlaySFX(0); } if (GetSceneName() == "HighScore Scene") { ps.PlaySFX(2); } if (GetSceneName() == "CourseGameplay") { ps.PlaySFX(1); } }
//if you choose a photo... public void ChoosePhoto() { if (myPhoto != null) { pse.PlaySFX(0); GameManager.gm.playerScore._num += myPhoto.finalScore; // adding a score to the player's score GameManager.gm.ratedPhotos.Add(myPhoto); // store this photo number into a list! pgm.monsterTracker++; pgm.GetNewPhotos(); } }
// Update is called once per frame void Update() { if (player.GetComponent <RailMovement>().location == player.GetComponent <RailManager>().location5) { startMove = true; myAnim.Play("run"); } if (startMove) { PlaySounds ps = GetComponent <PlaySounds>(); ps.PlaySFX(0); transform.position = Vector3.MoveTowards(transform.position, destination1.position, speed * Time.deltaTime); // moving towards the location! startMove = false; } }
// " Will be called from camera after regular rendering is done. " private void OnPostRender() { if (canTakePicture && (GameManager.gm.storedPhotos.Count < GameManager.gm.maxFilm)) { Photo.PhotoInstance newPhoto = new Photo.PhotoInstance(); monstersInPhoto = new List <MonsterScript>(); for (int i = 0; i < MonsterManager.monsters.Count; i++) { MonsterManager.monsters[i].isVisible(); if (MonsterManager.monsters[i].isinCamera) { MonsterManager.monsters[i].SetDistanceFromCamera(); MonsterManager.monsters[i].SetPositionFromCenter(); if (MonsterManager.monsters[i]._distance < 1000) { monstersInPhoto.Add(MonsterManager.monsters[i]); newPhoto.monsters.Add(MonsterManager.monsters[i]); } } else { MonsterManager.monsters[i]._distance = 0; } } newPhoto.PickMainMonster(); newPhoto.CalculateScore(); Texture2D newTexture; // here's the new texture we're about to add to our list of screenshots newTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); // getting screenshot by getting screen width/height and colord newTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, false); // reading all the pictures on the screen to be stored for our screenshot newTexture.Apply(); // making sure that texture is UP TO DATE! newPhoto.photoImage = newTexture; // setting screenshot to the Photo object screenshots.Add(newPhoto); // adding photo to list of screenshots! GameManager.gm.storedPhotos.Add(newPhoto); numberOfFilmLeft.text = "Film Left: " + (GameManager.gm.maxFilm - GameManager.gm.storedPhotos.Count); ShowNewPhotoOnCanvas(newTexture); // show the picture! PlaySounds pse = transform.parent.GetComponent <PlaySounds>(); pse.PlaySFX(2); // 0 is zoom in, 1 is zoom out, 2 is pic noise canTakePicture = false; // you can't take another one at the moment } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.GetInstanceID() == location1.gameObject.GetInstanceID()) { location = location2; } if (other.gameObject.GetInstanceID() == location2.gameObject.GetInstanceID()) { location = location3; } if (other.gameObject.GetInstanceID() == location3.gameObject.GetInstanceID()) { PlaySounds ps = GetComponent <PlaySounds>(); ps.PlaySFX(0); location = location4; } if (other.gameObject.GetInstanceID() == location4.gameObject.GetInstanceID()) { location = location1; } }