Esempio n. 1
0
    LevelPinLoader createLevelPinLoader(string levelToLoad)
    {
        GameObject     pin       = Resources.Load("levelPin") as GameObject;
        LevelPinLoader pinLoader = pin.GetComponent <LevelPinLoader>();

        pinLoader.levelToLoad = levelToLoad;

        return(pinLoader);
    }
Esempio n. 2
0
    // 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");
        }
    }
Esempio n. 3
0
    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);
    }