Ejemplo n.º 1
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        int currentRoomIndex = 0;

        for (int xNum = 0; xNum < numReflections; xNum++)
        {
            for (int zNum = 0; zNum < numReflections; zNum++)
            {
                GameObject reflection       = Instantiate <GameObject>(prefab);
                Transform  playerReflection = reflection.transform.Find("Player Stand-in");


                Vector3 newScale = new Vector3(1, 1, 1);
                if (xNum % 2 == 1)
                {
                    newScale.x = -1;
                }
                if (zNum % 2 == 1)
                {
                    newScale.z = -1;
                }

                reflection.transform.parent        = transform;
                reflection.transform.localScale    = newScale;
                reflection.transform.localPosition = new Vector3(xNum, 0, zNum);


                mirrorRoomStruct reflectedRoom = new mirrorRoomStruct();
                reflectedRoom.baseRoom      = reflection;
                reflectedRoom.playerStandin = playerReflection;
                if (xNum == 0 && zNum == 0)
                {
                    reflection.SetActive(false);
                    playerReflection.gameObject.SetActive(true);
                    currentRoom = reflectedRoom;
                }

                reflectedRoom.baseRoom.GetComponent <mirrorRoomPrefab>().Index = currentRoomIndex;
                rooms[currentRoomIndex] = reflectedRoom;

                currentRoomIndex++;
            }
        }
    }
Ejemplo n.º 2
0
 public void SetCurrentRoom(int index)
 {
     currentRoom = rooms[index];
 }