void Start() { rb = GetComponent <Rigidbody2D>(); rb.AddForce(new Vector2(Random.Range(-200, 200), Random.Range(50, 200))); txt_moneda = GameObject.Find("Texto_moneda"); cm = txt_moneda.GetComponent <ControlMonedas>(); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D> (); rb.AddForce(new Vector2(Random.Range(-100, 100), 100)); txt_moneda = GameObject.Find("TextoMoneda"); //Find me busca un objeto en la escena. cm = txt_moneda.GetComponent <ControlMonedas>(); }
// Use this for initialization void Start() { Destroy(gameObject, 5); rb = GetComponent <Rigidbody2D> (); rb.AddForce(new Vector2(Random.Range(-10, 10), 10)); txt_moneda = GameObject.Find("TextoMoneda"); ctrl_moneda = txt_moneda.GetComponent <ControlMonedas> (); }
// Use this for initialization void Start() { rigi = GetComponent <Rigidbody2D>(); Destroy(gameObject, 10); // sE DESTRUYE A LOS 3 SEGUNDOS rigi.AddForce(new Vector2(Random.Range(-100, 100), 100)); txtMoneda = GameObject.Find("TextoMoneda"); //busca los objetos en la escena y el del nombre lo mete ctrl_moneda = txtMoneda.GetComponent <ControlMonedas>(); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D> (); rb.AddForce(new Vector2(Random.Range(-20, 20), 20)); txt_moneda = GameObject.Find("texto_moneda"); ctrl_moneda = txt_moneda.GetComponent <ControlMonedas> (); Destroy(gameObject, 600); }
void Start() { //rb tiene los componenetes del Rigidbody2D rb = GetComponent <Rigidbody2D> (); //A rb se le añade una fuerza aleatoria entre dos valores que queremos en x e y. rb.AddForce(new Vector2(Random.Range(-200, 200), Random.Range(50, 200))); //Encuentra en la escena Texto_moneda txt_moneda = GameObject.Find("Texto_moneda"); //cm accede a los componente de ControlMonedas que esa dentro de Texto_moneda se podría hacer como cm = GameObject.Find ("Texto_moneda").GetComponent<>(ControlMonedas); cm = txt_moneda.GetComponent <ControlMonedas> (); }
// Use this for initialization void Start() { txtMoneda = GameObject.Find("TextoMoneda"); //busca los objetos en la escena y el del nombre lo mete ctrl_moneda = txtMoneda.GetComponent <ControlMonedas>(); }