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

        pinLoader.levelToLoad = levelToLoad;

        return(pinLoader);
    }
Ejemplo 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");
        }
    }
Ejemplo 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);
    }