LevelPinLoader createLevelPinLoader(string levelToLoad) { GameObject pin = Resources.Load("levelPin") as GameObject; LevelPinLoader pinLoader = pin.GetComponent <LevelPinLoader>(); pinLoader.levelToLoad = levelToLoad; return(pinLoader); }
// Update is called once per frame void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit) && Input.GetMouseButton(0)) { LevelPinLoader pinLoader = hit.collider.gameObject.GetComponent <LevelPinLoader>(); levelToLoad = pinLoader.levelToLoad; SceneManager.LoadScene("mainScene"); } }
void placePinLoader(float alpha, float teta, string levelToLoad) { float alphaRad = alpha * Mathf.Deg2Rad; float tetaRad = teta * Mathf.Deg2Rad; float x = radius * Mathf.Sin(alphaRad) * Mathf.Cos(tetaRad); float z = -radius *Mathf.Sin(alphaRad) * Mathf.Sin(tetaRad); float y = radius * Mathf.Cos(alphaRad); LevelPinLoader pinLoader = createLevelPinLoader(levelToLoad); pinLoader.transform.position = new Vector3(x, y, z); Instantiate(pinLoader, this.transform); }