Example #1
0
 void Cannons(AllData allData)
 {
     if (allData.cannon != null)
     {
         float[] cannonData   = allData.cannon.stats;
         int     num          = allData.cannon.numStats;
         int     cannonAmount = cannonData.Length / num;//because every n'th element starts a new box
         for (int i = 0; i < cannonAmount; i++)
         {
             LauncherController cannon = Instantiate(cannonPrefab, new Vector3(0, 0, 0), Quaternion.identity);
             cannon.GetComponent <Price>().byPass = true;
             cannon.transform.position            = new Vector3(cannonData[(i * num)], cannonData[(i * num) + 1], 0);
             cannon.transform.rotation            = Quaternion.Euler(0, 0, cannonData[(i * num) + 2]);
             cannon.coolDown    = cannonData[(i * num) + 3];
             cannon.launchForce = cannonData[(i * num) + 4];
             cannon.launchRotationVertex.rotation = Quaternion.Euler(0, 0, cannonData[(i * num) + 5]);
         }
     }
 }