Exemplo n.º 1
0
 // Destroys all holders + reset
 public void DestroyAndReset()
 {
     UtilSort.DestroyObjects(holders);
     containsHolders      = false;
     HolderBase.HOLDER_NR = 0;
     superElement         = null;
 }
Exemplo n.º 2
0
    public void InitSortAlgorithm(SortMain sortMain, float algorithmSpeed)
    {
        this.sortMain = sortMain;
        InitTeachingAlgorithm(algorithmSpeed);

        minValue = sortMain.ElementManager.MinValue;
        maxValue = sortMain.ElementManager.MaxValue;
    }
Exemplo n.º 3
0
 // Destroys all elements + reset
 public void DestroyAndReset()
 {
     Util.DestroyObjects(sortingElements);
     containsElements = false;
     SortingElementBase.SORTING_ELEMENT_NR = 0;
     usedValues    = new HashSet <int>();
     currentMoving = null;
     superElement  = null;
 }
Exemplo n.º 4
0
 public void InitManager()
 {
     superElement = GetComponent <SortMain>();
 }
Exemplo n.º 5
0
 public void InitManager() // not really needed anymore
 {
     superElement = GetComponentInParent <SortMain>();
 }
Exemplo n.º 6
0
    /* Creates a list of objects
     * - Puts them ontop of another object if positions are provided
     */
    public static GameObject[] CreateObjects(GameObject prefab, int numberOfElements, Vector3[] pos, float spreadDist, SortMain superElement)
    {
        GameObject[] objects = new GameObject[numberOfElements];
        GameObject   element;

        for (int x = 0; x < numberOfElements; x++)
        {
            if (pos.Length == 1)
            {
                element = Instantiate(prefab, pos[0] + new Vector3(x * spreadDist, 0f, 0f), Quaternion.identity);
            }
            else
            {
                element = Instantiate(prefab, pos[x], Quaternion.identity);
            }

            element.GetComponent <ISortSubElement>().SuperElement = superElement;
            objects[x] = element;
        }
        return(objects);
    }
Exemplo n.º 7
0
 public void InitSortingManager(SortMain sortMain)
 {
     this.sortMain = sortMain;
     Debug.Log("Algorithm: " + AlgorithmManager);
 }