Esempio n. 1
0
 public void setCam(int self_ID, int parent_ID, string LR, int joueur_ID)
 {
     foreach (GameObject go in GameObject.FindGameObjectsWithTag("Camera Objet"))
     {
         if (go.GetComponent <PhotonView>().viewID == self_ID)
         {
             foreach (GameObject goo in GameObject.FindGameObjectsWithTag("Portail"))
             {
                 if (goo.GetComponent <PhotonView>().viewID == parent_ID)
                 {
                     go.transform.parent = goo.transform;
                 }
             }
             SelfCam sc = go.AddComponent <SelfCam>();
             sc.setSide(LR);
             sc.setBuilder(joueur_ID);
             if (LR == "l")
             {
                 sc.GetComponent <UnityEngine.Camera>().targetTexture = Resources.Load("Left Render") as RenderTexture;
             }
             else
             {
                 sc.GetComponent <UnityEngine.Camera>().targetTexture = Resources.Load("Right Render") as RenderTexture;
             }
         }
     }
 }
Esempio n. 2
0
 public void instanciateMe(Vector3 pos, Vector3 rot, string LR, string name = "Lance", bool b = false, Vector3 begin = new Vector3())
 {
     if (Globals.isMulti)
     {
         GameObject go = PhotonNetwork.Instantiate(name, pos, Quaternion.Euler(rot), 0);
         photonView.RPC("addType", PhotonTargets.All, go.GetComponent <PhotonView>().viewID, name);
         photonView.RPC("setLR", PhotonTargets.All, go.GetComponent <PhotonView>().viewID, LR, photonView.viewID, b, begin);
         if (b)
         {
             GameObject cam = PhotonNetwork.Instantiate("Camera Objet", pos, Quaternion.Euler(rot + new Vector3(0, 0, 0)), 0);
             photonView.RPC("setCam", PhotonTargets.All, cam.GetComponent <PhotonView>().viewID, go.GetComponent <PhotonView>().viewID, LR, photonView.viewID);
         }
     }
     else
     {
         GameObject go = Instantiate(name == "Lance" ? Lance : Portail);
         go.transform.position         = pos;
         go.transform.localEulerAngles = rot;
         Portails po = go.AddComponent <Portails>();
         foreach (Portails goo in FindObjectsOfType <Portails>())
         {
             if (goo.theTruth == LR)
             {
                 Destroy(goo.gameObject);
             }
             else if (goo.theTruth == null)
             {
                 goo.theTruth = LR;
                 goo.stop     = b;
                 goo.is_done  = b;
                 if (b)
                 {
                     goo.begin = begin;
                 }
             }
         }
         if (b)
         {
             GameObject cam = Instantiate(Resources.Load("Camera Objet") as GameObject);
             SelfCam    sc  = cam.AddComponent <SelfCam>();
             sc.setSide(LR);
             cam.transform.parent           = go.transform;
             cam.transform.localPosition    = new Vector3();
             cam.transform.localEulerAngles = new Vector3();
             if (LR == "l")
             {
                 cam.GetComponent <UnityEngine.Camera>().targetTexture = Resources.Load("Left Render") as RenderTexture;
             }
             else
             {
                 cam.GetComponent <UnityEngine.Camera>().targetTexture = Resources.Load("Right Render") as RenderTexture;
             }
         }
     }
 }