void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } naveScript = GameObject.Find("Ship").GetComponent <NaveScript> (); levelManager = GameObject.Find("LevelsManager").GetComponent <LevelManager> (); soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager> (); lifes = PlayerPrefs.GetInt("Lifes"); score = PlayerPrefs.GetInt("Score"); bestScore = PlayerPrefs.GetInt("BestScore"); actualLevel = PlayerPrefs.GetInt("Level"); timeGame = PlayerPrefs.GetFloat("Time", 0); levelManager.ChangeLevel(actualLevel); soundManager.PlayMusic_Game("play"); soundManager.ForceNotExplotion(true); }
void crearEscenario() { //Instanciar la nave, los pickups y los enemigos Instantiate(NavePrefab, transform.position, transform.rotation); //Obtener la camara camara = GameObject.FindWithTag("MainCamera"); camaraScript = camara.GetComponent <CameraScript>(); //Obtener la nave nave = GameObject.FindWithTag("Nave"); naveScript = nave.GetComponent <NaveScript>(); //Asociar la camara a la nave camaraScript.target = nave.transform; //Activar texto en pantalla GameObject.Find("/MainCamera/Plane/Text/collectedText").SetActive(true); GameObject.Find("/MainCamera/Plane/Text/killedText").SetActive(true); GameObject.Find("/MainCamera/Plane/Text/timeText").SetActive(true); collectedText = GameObject.Find("/MainCamera/Plane/Text/collectedText").GetComponent <TextMesh>(); killedText = GameObject.Find("/MainCamera/Plane/Text/killedText").GetComponent <TextMesh>(); timeText = GameObject.Find("/MainCamera/Plane/Text/timeText").GetComponent <TextMesh>(); }
// Use this for initialization void Start() { naveScript = Nave.GetComponent <NaveScript>(); }
// Use this for initialization void Start() { nave = GameObject.FindWithTag("Nave"); naveScript = nave.GetComponent <NaveScript>(); }