Ejemplo n.º 1
0
    public void Fill(int x, int y, int z, int r, int damage, Side side)
    {
        GameObject copy = Instantiate(orePrefabs[r], transform.position + new Vector3(x * spacing, y * spacing, z * depthSpacing), transform.rotation, layers[z]);
        Ore        o    = copy.GetComponent <Ore>();

        o.SetSortOrder(-z * 10);
        if (damage > 0)
        {
            //Debug.Log($"Random Damage {damage}");
            o.Smash(damage, side, true);
        }
        grid[x, y, z] = o;
    }
Ejemplo n.º 2
0
 void Randomize()
 {
     for (int i = 0; i < xSize; i++)
     {
         for (int j = 0; j < ySize; j++)
         {
             for (int k = 0; k < zSize; k++)
             {
                 int        r    = Random.Range(0, orePrefabs.Length);
                 GameObject copy = Instantiate(orePrefabs[r], transform.position + new Vector3(i * spacing, j * spacing, k * depthSpacing), transform.rotation, layers[k]);
                 Ore        o    = copy.GetComponent <Ore>();
                 o.SetSortOrder(-k * 10);
                 grid[i, j, k] = o;
                 // add to the appropriate events
                 // allows me to change the alpha of a bunch of them when the player changes depth
             }
         }
     }
 }