public void startComparison()
    {
        offset       = transform.position;
        totalSpawned = 0;

        if (spawnedObjects.Count > 0)
        {
            foreach (GameObject spawned in spawnedObjects)
            {
                Destroy(spawned);
            }

            spawnedObjects.Clear();
        }


        SpawnCubes();

        if (spawnedObjects.Count == 0)
        {
            SpawnCubes();
        }

        EnvironmentCompare parentCompare = GetComponentInParent <EnvironmentCompare>();

        if (cubeID == 0)
        {
            parentCompare.val1 = totalSpawned;
        }
        else if (cubeID == 1)
        {
            parentCompare.val2 = totalSpawned;
        }
    }
Exemple #2
0
    public void SetLists()
    {
        foreach (Transform child in transform)
        {
            EnvironmentCompare compare = child.GetComponent <EnvironmentCompare>();
            if (compare != null)
            {
                compareList.Add(compare);
            }
        }

        for (int i = 0; i < 3; i++)
        {
            compareParents.Add(transform.GetChild(i).GetComponent <Transform>());
        }
    }
    // Start is called before the first frame update
    void OnEnable()
    {
        parentCompare = GetComponentInParent <EnvironmentCompare>();

        originalScale = transform.localScale;
    }