Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class CubeHull : MonoBehaviour
  6. {
  7.  
  8.     public GameObject oggettoDaInstanziare;
  9.     public int ripetizioni;
  10.     public float distanza;
  11.  
  12.     void Start()
  13.     {
  14.         for (int x = 0; x < ripetizioni; x++)
  15.         {
  16.             for (int y = 0; y < ripetizioni; y++)
  17.             {
  18.                 for (int z = 0; z < ripetizioni; z++)
  19.                 {
  20.                     if (z == 0 || z == ripetizioni - 1)
  21.                     {
  22.                         GameObject go = Instantiate(oggettoDaInstanziare, new Vector3(distanza * x, distanza * y, distanza * z), Quaternion.identity);
  23.                     }
  24.                     else if (y == 0 || y == ripetizioni - 1)
  25.                     {
  26.                         GameObject go = Instantiate(oggettoDaInstanziare, new Vector3(distanza * x, distanza * y, distanza * z), Quaternion.identity);
  27.                     }
  28.  
  29.                     else if (x == 0 || x == ripetizioni - 1)
  30.                     {
  31.                         GameObject go = Instantiate(oggettoDaInstanziare, new Vector3(distanza * x, distanza * y, distanza * z), Quaternion.identity);
  32.                     }
  33.                 }
  34.             }
  35.         }
  36.  
  37.  
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement