コード例 #1
0
ファイル: HolderManager.cs プロジェクト: ZindreX/sorting
 // Destroys all holders + reset
 public void DestroyAndReset()
 {
     UtilSort.DestroyObjects(holders);
     containsHolders      = false;
     HolderBase.HOLDER_NR = 0;
     superElement         = null;
 }
コード例 #2
0
ファイル: SortAlgorithm.cs プロジェクト: ZindreX/sorting
    public void InitSortAlgorithm(SortMain sortMain, float algorithmSpeed)
    {
        this.sortMain = sortMain;
        InitTeachingAlgorithm(algorithmSpeed);

        minValue = sortMain.ElementManager.MinValue;
        maxValue = sortMain.ElementManager.MaxValue;
    }
コード例 #3
0
ファイル: ElementManager.cs プロジェクト: ZindreX/sorting
 // 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;
 }
コード例 #4
0
ファイル: HolderManager.cs プロジェクト: ZindreX/sorting
 public void InitManager()
 {
     superElement = GetComponent <SortMain>();
 }
コード例 #5
0
ファイル: BucketManager.cs プロジェクト: ZindreX/sorting
 public void InitManager() // not really needed anymore
 {
     superElement = GetComponentInParent <SortMain>();
 }
コード例 #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);
    }
コード例 #7
0
 public void InitSortingManager(SortMain sortMain)
 {
     this.sortMain = sortMain;
     Debug.Log("Algorithm: " + AlgorithmManager);
 }