예제 #1
0
    void subsequent(int x, int y)
    {
        //Debug.Log ("Got here too");
        int i, j;
        int[] order = new int[4];
        order [0] = 1;
        order [1] = 2;
        order [2] = 3;
        order [3] = 4;

        order = shuffle (order);
        order = shuffle (order);
        order = shuffle (order);

        Image slot = null;
        while (slot == null) {
            foreach (int element in order) {
                //Debug.Log ("In loop");

                for (int m = 0; m < 2; m++) {
                    for(int n = 0; n < (slotsAndItem/2); n++){
                        if(closet[x,y].dropZoneID == clothesLayout[m,n].itemID){
                            previousItem = clothesLayout[m,n];
                        }
                    }
                }

                switch (element) {
                case 1:
                    if (!((x + 1) > 1)) {
                        i = x + 1;
                        j = y;
                        if (!(closet [i, j].filled)) {
                            //Debug.Log ("Pick case 1");
                            slot = closet [i, j].GetComponent<Image> ();
                            graphX.Push (i);
                            graphY.Push (j);
                            slotx = i;
                            sloty = j;
                            StartCoroutine (belowItemPlacement ());
                        }
                    }
                    break;
                case 2:
                    if (!((x - 1) < 0)) {
                        i = x - 1;
                        j = y;
                        if (!(closet [i, j].filled)) {
                            //Debug.Log ("Pick case 2");
                            slot = closet [i, j].GetComponent<Image> ();
                            graphX.Push (i);
                            graphY.Push (j);
                            slotx = i;
                            sloty = j;
                            StartCoroutine (aboveItemPlacement ());
                        }
                    }
                    break;
                case 3:
                    if (!((y + 1) > ((slotsAndItem / 2) - 1))) {
                        i = x;
                        j = y + 1;
                        if (!(closet [i, j].filled)) {
                            //Debug.Log ("Pick case 3");
                            slot = closet [i, j].GetComponent<Image> ();
                            graphX.Push (i);
                            graphY.Push (j);
                            slotx = i;
                            sloty = j;
                            StartCoroutine (rightItemPlacement ());
                        }
                    }
                    break;
                case 4:
                    if (!((y - 1) < 0)) {
                        i = x;
                        j = y - 1;
                        if (!(closet [i, j].filled)) {
                            //Debug.Log ("Pick case 4");
                            slot = closet [i, j].GetComponent<Image> ();
                            graphX.Push (i);
                            graphY.Push (j);
                            slotx = i;
                            sloty = j;
                            StartCoroutine (leftItemPlacement ());
                        }
                    }
                    break;
                }

                if (slot != null)
                    break;
            }

            if (slot == null) {
                if (graphX.Count != 0 && graphY.Count != 0) {
                    x = graphX.Pop ();
                    y = graphY.Pop ();
                } else {
                    break;
                }
            }
        }

            for (int m = 0; m < 2; m++) {
                for(int n = 0; n < (slotsAndItem/2); n++){
                    if(closet[slotx,sloty].dropZoneID == clothesLayout[m,n].itemID){
                        currentItem = clothesLayout[m,n];
                    }
                }
            }

            if(slot != null)
                slot.color = Color.green;

            waiting = true;
    }
예제 #2
0
    IEnumerator aboveItemPlacement()
    {
        speaking = true;
        //ClosetDraggable previousItem = currentItem;

        for (int m = 0; m < 2; m++) {
            for(int n = 0; n < (slotsAndItem/2); n++){
                if(closet[slotx,sloty].dropZoneID == clothesLayout[m,n].itemID){
                    currentItem = clothesLayout[m,n];
                }
            }
        }

        Voices.instruction = null;
        Voices.instruction = new List<AudioSource>();

        Voices.PlayPlaceTheClip ();
        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);

        switch (currentItem.thisArticle) {
        case ClosetDraggable.ArticleOfClothing.GALOSHES:
            Voices.PlayGaloshesClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.JEANS:
            Voices.PlayJeansClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.SCARF:
            Voices.PlayScarfClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.BOOTS:
            Voices.PlayBootsClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.SANDALS:
            Voices.PlaySandalsClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.TIE:
            Voices.PlayTieClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.VEST:
            Voices.PlayVestClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.SHIRT:
            Voices.PlayShirtClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.COAT:
            Voices.PlayCoatClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.WINDBREAKER:
            Voices.PlayWindBreakerClip ();
            break;
        }
        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);
        Voices.PlayAboveTheClip();

        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);

        switch (previousItem.thisArticle) {
        case ClosetDraggable.ArticleOfClothing.GALOSHES:
            Voices.PlayGaloshesClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.JEANS:
            Voices.PlayJeansClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.SCARF:
            Voices.PlayScarfClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.BOOTS:
            Voices.PlayBootsClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.SANDALS:
            Voices.PlaySandalsClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.TIE:
            Voices.PlayTieClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.VEST:
            Voices.PlayVestClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.SHIRT:
            Voices.PlayShirtClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.COAT:
            Voices.PlayCoatClip ();
            break;
        case ClosetDraggable.ArticleOfClothing.WINDBREAKER:
            Voices.PlayWindBreakerClip ();
            break;
        }
        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);
        speaking = false;
    }
예제 #3
0
    ClosetDraggable[] shuffle(ClosetDraggable[] ClosetDraggableArray)
    {
        int n = ClosetDraggableArray.Length;

        for (int i = 0; i < n; i++) {
            int r = UnityEngine.Random.Range (i, n);
            ClosetDraggable temp = ClosetDraggableArray[i];
            ClosetDraggableArray[i] = ClosetDraggableArray[r];
            ClosetDraggableArray[r] = temp;
        }

        return ClosetDraggableArray;
    }
예제 #4
0
    IEnumerator firstItemPlacement()
    {
        speaking = true;
        currentItem = orderOfItem.Dequeue();
        //ClosetDraggable itemNext = orderOfItemStatic.Find (currentItem).Previous.Value;
        Voices.instruction = null;
        Voices.instruction = new List<AudioSource>();
        Voices.PlayPlaceTheClip ();
        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);

        switch (currentItem.thisArticle) {
        case ClosetDraggable.ArticleOfClothing.GALOSHES:
                Voices.PlayGaloshesClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.JEANS:
                Voices.PlayJeansClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.SCARF:
                Voices.PlayScarfClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.BOOTS:
                Voices.PlayBootsClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.SANDALS:
                Voices.PlaySandalsClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.TIE:
                Voices.PlayTieClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.VEST:
                Voices.PlayVestClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.SHIRT:
                Voices.PlayShirtClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.COAT:
                Voices.PlayCoatClip ();
                break;
        case ClosetDraggable.ArticleOfClothing.WINDBREAKER:
                Voices.PlayWindBreakerClip ();
                break;
        }
        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);

        Voices.PlayHereClip ();
        Voices.instruction.Add (Voices.currentAudioPlaying);
        yield return new WaitForSeconds (Voices.currentAudioPlaying.clip.length);
        speaking = false;
    }