Quantcast
Channel: Questions in topic: "4.1"
Viewing all articles
Browse latest Browse all 45

How to make a fnaf game in unity

$
0
0
using System.Collections; using UnityEngine.UI; using System.Collections.Generic; using UnityEngine; public class CameraScript : MonoBehaviour { public Camera[] Cams; public Camera cam1; public Camera cam2; public Camera cam3; public Camera mcam; public Camera cam4; public AudioSource[] audioSources; public AudioSource CamChangeSound; public Button Cam1Btn; public Button Cam2Btn; public Button Cam3Btn; public Button MCamBtn; public Button ShowCamsBtn; public Button Cam4Btn; // Start is called before the first frame update void Start() { mcam.depth = 10; Cam1Btn.gameObject.SetActive(false); Cam2Btn.gameObject.SetActive(false); Cam3Btn.gameObject.SetActive(false); Cam4Btn.gameObject.SetActive(false); MCamBtn.gameObject.SetActive(false); ShowCamsBtn.gameObject.SetActive(true); Cam1Btn.Select(); } // Update is called once per frame void Update() { } public void OnCamButtonClicked(string wichButton) { foreach (Camera cam in Cams) cam.depth = -10; if (wichButton == "Cam1Btn") { cam1.depth = 10; CamChangeSound.Play(); } else if (wichButton == "Cam2Btn") { cam2.depth = 10; CamChangeSound.Play(); } if (wichButton == "Cam3Btn") { cam3.depth = 10; CamChangeSound.Play(); } else if (wichButton == "MCamBtn") { mcam.depth = 10; Cam1Btn.gameObject.SetActive(false); Cam2Btn.gameObject.SetActive(false); Cam3Btn.gameObject.SetActive(false); Cam4Btn.gameObject.SetActive(false); MCamBtn.gameObject.SetActive(false); ShowCamsBtn.gameObject.SetActive(true); } if (wichButton == "ShowCamsBtn") { cam1.depth = 10; Cam1Btn.gameObject.SetActive(true); Cam2Btn.gameObject.SetActive(true); Cam3Btn.gameObject.SetActive(true); Cam4Btn.gameObject.SetActive(true); MCamBtn.gameObject.SetActive(true); ShowCamsBtn.gameObject.SetActive(false); } else if (wichButton == "Cam4Btn") { cam4.depth = 10; CamChangeSound.Play(); } } // fixed update is called sum time void FixedUpdate() { } }

Viewing all articles
Browse latest Browse all 45

Latest Images

Trending Articles





Latest Images