void Start() { playerr bullet = GameObject.FindGameObjectWithTag("Player").GetComponent <playerr>(); GetComponent <Rigidbody>().AddForce(bullet.goToTarget() * 2000); transform.rotation = Quaternion.LookRotation(bullet.goToTarget()); Destroy(gameObject, 2); }
void Start() { okimg = trainOKbt.GetComponent <Image> (); //PlayerPrefs.SetInt ("newgame", 0); //Debug purpose , force write each session is anew game ch = Camera.main.GetComponent <camHandle> (); pl = playerr.GetComponent <playerr> (); pauseBtImage = pauseBt.GetComponent <Image> (); for (int i = 0; i < 1000; i++) { currentY += 1.6f; w[i] = Instantiate(walkable, new Vector3(0, 0, currentY), Quaternion.identity); w [i].transform.rotation = Quaternion.identity; w [i].GetComponent <Renderer> ().material.SetColor("_EmissionColor", new Color32((byte)Random.Range(10, 20), (byte)Random.Range(10, 20), (byte)Random.Range(10, 20), 0)); currentY += 1.6f; ju[i] = Instantiate(inter, new Vector3(0, 0.33f, currentY), Quaternion.Euler(new Vector3(0, Random.Range(1, 180), 0))); } if (PlayerPrefs.GetInt("newgame") == 0) { train(); } }