Esempio n. 1
0
    // Called in Bridge.cs
    public void setUniverse(int num)
    {
        Debug.Log("Universe Sent " + num);
        universeNum = num;

        // Get the origin of the set Universe
        Vector3 origin = GameObject.Find("Universe" + num + "/Managers/OriginManager").GetComponent<Universe>().origin;
        Debug.Log(num + "Universe " + origin);

        // Set camPos to bgPos + 1000 to z
        Vector3 camPos = new Vector3(origin.x, origin.y, origin.z + 0.1f);
        Debug.Log("camera positons " + camPos);
        Camera = (Transform)Instantiate(camPrefab, camPos, new Quaternion(0, 0, 0, 0));
        Camera.name = "Camera " + num;

        // It is the first time this function has been called
        if (characterNum == 99)
        {
            characterNum = universeNum;
            Log.Note("Activate initial");
            playerMovement = GameObject.Find("Character" + num).GetComponent<PlayerMovement>();
            playerMovement.activateCharacter(num, num);
            playerManager = GameObject.Find("Character" + num).GetComponent<PlayerManager>();
            playerManager.activateCharacter(num);
            FiringHandler fireHandler = GameObject.Find("Character" + num).GetComponent<FiringHandler>();
            fireHandler.activateCharacter(num);
        }

        playerManager.universeNumber = num;
    }