public void Fill()
 {
     for (int i = 0; i < rooms; i++)
     {
         LayoutGen a = roomlist [i].GetComponent <LayoutGen> ();
         if (Physics.OverlapSphere(a.xPlus.transform.position, 5).Length < 1)
         {
             GameObject child = Instantiate(DoorStop, a.transform.position + xpOffset1, a.transform.rotation);
             child.transform.localScale = new Vector3(child.transform.localScale.x, child.transform.localScale.y, 12);
             child = Instantiate(DoorStop, a.transform.position + xpOffset2, a.transform.rotation);
             child.transform.localScale = new Vector3(child.transform.localScale.x, child.transform.localScale.y, 12);
         }
         if (Physics.OverlapSphere(a.xMinus.transform.position, 5).Length < 1)
         {
             GameObject child = Instantiate(DoorStop, a.transform.position + xmOffset1, a.transform.rotation);
             child.transform.localScale = new Vector3(child.transform.localScale.x, child.transform.localScale.y, 12);
             child = Instantiate(DoorStop, a.transform.position + xmOffset2, a.transform.rotation);
             child.transform.localScale = new Vector3(child.transform.localScale.x, child.transform.localScale.y, 12);
         }
         if (Physics.OverlapSphere(a.zPlus.transform.position, 5).Length < 1)
         {
             GameObject child = Instantiate(DoorStop, a.transform.position + zpOffset1, a.transform.rotation);
             child.transform.localScale = new Vector3(12, child.transform.localScale.y, child.transform.localScale.z);
             child = Instantiate(DoorStop, a.transform.position + zpOffset2, a.transform.rotation);
             child.transform.localScale = new Vector3(12, child.transform.localScale.y, child.transform.localScale.z);
         }
         if (Physics.OverlapSphere(a.zMinus.transform.position, 5).Length < 1)
         {
             GameObject child = Instantiate(DoorStop, a.transform.position + zmOffset1, a.transform.rotation);
             child.transform.localScale = new Vector3(12, child.transform.localScale.y, child.transform.localScale.z);
             child = Instantiate(DoorStop, a.transform.position + zmOffset2, a.transform.rotation);
             child.transform.localScale = new Vector3(12, child.transform.localScale.y, child.transform.localScale.z);
         }
     }
 }
Exemple #2
0
    void Start()
    {
        layoutGen = new LayoutGen();
        grid      = layoutGen.GenerateLayout(maxWidth, maxHeight, roomsToSpawn, spawnPos);
        layoutGen.DebugDisplay();

        SpawnRooms();
    }