void Start() { score = GameObject.Find("score").GetComponent <score_script> (); player = FindObjectOfType <player_script>().transform; rb = GetComponent <Rigidbody2D>(); rb.velocity = transform.up * speed; }
// Use this for initialization void Start() { scoreObj = GameObject.Find("score").GetComponent <score_script> (); player = FindObjectOfType <player_script>().transform; Rigidbody2D rb = GetComponent <Rigidbody2D> (); sprite = GetComponent <SpriteRenderer>(); }
// Use this for initialization void Start() { PlayerPrefs.SetString("dead", "false"); //Pegando referencias anim = GetComponent <Animator>(); sprite = GetComponent <SpriteRenderer>(); score = GameObject.Find("score").GetComponent <score_script> (); }
//Instanciando referencias void Start() { score = GameObject.Find("score").GetComponent <score_script> (); player = FindObjectOfType <player_script>().transform; rb = GetComponent <Rigidbody2D> (); var speed = Random.Range(-1, -4); rb.velocity = new Vector2(0, speed); sprite = GetComponent <SpriteRenderer>(); }
// instancia referencias void Start() { player = FindObjectOfType <player_script>().transform; Rigidbody2D rb = GetComponent <Rigidbody2D> (); scoreObj = GameObject.Find("score").GetComponent <score_script> (); // Faz o inimigo rodar em si mesmo aleatoriamentre entre -200 e 200 rb.angularVelocity = Random.Range(-200, 200); sprite = GetComponent <SpriteRenderer>(); }
void Start() { // Adicionar speed à velocidade do inimigo Rigidbody2D rb = GetComponent <Rigidbody2D> (); scoreObj = GameObject.Find("score").GetComponent <score_script> (); var speed = Random.Range(-2, -6); rb.velocity = new Vector2(0, speed); // Faz o inimigo rodar em si mesmo aleatoriamentre entre -200 e 200 rb.angularVelocity = Random.Range(-180, 180); // Destroi o inimigo após 3s, que ele não está mais visível na tela Destroy(gameObject, 5); }
void Start() { scoreObj = GameObject.Find("score").GetComponent <score_script> (); // Chamar a função 'addEnemy' a cada 'spawnTime' segundos InvokeRepeating("addEnemy", spawnTime, spawnTime); }
//Instancia as referenciass void Start() { scoreObj = GameObject.Find("score").GetComponent <score_script> (); InvokeRepeating("Fire", fire_rate, fire_rate); //Chama o metodo fire para atirar InvokeRepeating("Fire2", fire_rate2, fire_rate2); //Chama o metodo fire para atirar }