// Start is called before the first frame update void Start() { //Como desde el prefab no podemos arrastrar el GameObject, lo buscamos en la escena SpaceShip = GameObject.Find("Spaceship"); //Asociamos a la variable el componente de la nave (es decir su script) spaceshipMove = SpaceShip.GetComponent <SpaceshipMove>(); }
// Start is called before the first frame update void Start() { SpaceShip = GameObject.Find("StarSparrow1"); spaceshipMove = SpaceShip.GetComponent <SpaceshipMove>(); initObject = GameObject.Find("InitObject"); initGame = initObject.GetComponent <InitGame>(); obstacleSpeed = initGame.speed; }
// Start is called before the first frame update void Start() { //Accedo al script de la nave spaceshipMove = Nave.GetComponent<SpaceshipMove>(); //Lanzo la corrutina StartCoroutine("InstanciadorEsferas"); }
// Start is called before the first frame update void Start() { //asignamos el componente render rend = GetComponent <Renderer>(); //obtener el script GameObject InitEmpty = GameObject.Find("Spaceship"); initgame = InitEmpty.GetComponent <SpaceshipMove>(); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "obstacle") { Nave = GameObject.Find("StarSparrow1"); spaceship = Nave.GetComponent <SpaceshipMove>(); spaceship.Contador++; Destroy(gameObject); Destroy(other.gameObject); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "obstacle") { muerto = true; Nave = GameObject.Find("StarSparrow1"); spaceship = Nave.GetComponent <SpaceshipMove>(); spaceship.StopCoroutine("Tiempojuego"); myMesh.enabled = false; pos = transform.position; audioSourceExp = GetComponent <AudioSource>(); audioSourceExp.PlayOneShot(explosion, 0.2F); ObstacleMove.obstacleSpeed = 0; Instantiate(ExplosionParticulas, pos, Quaternion.identity); Invoke("CambiarEscena", 1.5f); } }
// Start is called before the first frame update void Start() { //Distancia inical 25 columnas for (int n = 1; n < 25; n++) { randomNumber = Random.Range(-7f, 6f); Vector3 RandomPos = InitPos.position + new Vector3(randomNumber, 0, n * -5); Instantiate(Columna, RandomPos, Quaternion.identity); } //Accedo al script de la nave spaceshipMove = Nave.GetComponent <SpaceshipMove>(); //Lanzo la corrutina StartCoroutine("InstanciadorColumnas"); }