Esempio n. 1
0
    public void moveDice(string f, string t, int amt, bool b)
    {
        Die[] dice = gameLayout.getDiceInZone(f);

        int count = amt;

        if (count <= 0 || count > dice.Length)
        {
            count = dice.Length;
        }
        Debug.Log("Moving " + count + " dice from " + f + " to " + t);
        for (int i = 0; i < count; i++)
        {
            //dice[i].moveDie(gameLayout.getZoneDiceParent(t).transform);
            DieLogic.moveDie(dice[i], gameLayout.getZone(t));
            dice[i].toggleVisibility(b);

            if (b)
            {
                SoundControl.instance.playAudio("dice", "slide");
            }
            else
            {
                SoundControl.instance.playAudio("dice", "drop_cup");
            }
        }
    }
Esempio n. 2
0
    //     IEnumerator
    public void drawDice(int amount)
    {
        if (GameState.hasDrawn)
        {
            return;
        }
        int count = amount;

        Zone   supportT = gameLayout.getZone(getCurrentZoneS("zoneSupport"));
        string support  = getCurrentZoneS("zoneSupport");
        string supply   = getCurrentZoneS("zoneSupply");
        string stored   = getCurrentZoneS("zoneStored");

        Die[] h = gameLayout.getDiceInZone(supply);
        Die[] d = gameLayout.getDiceInZone(stored);

        int iDraw;


        if (h != null && h.Length == 0 && d.Length != 0)
        {
            moveDice(stored, supply, false);
            h = gameLayout.getDiceInZone(supply);
            d = new Die[0];
        }

        //moveDice(supply, support, amount);

        /*
         *  What to do if can't move the asked amount?
         *      If 'from' is "supply" then
         *          moveDice(stored, supply, false)
         *          continue
         */
        while (count != 0 && h.Length != 0 && h != null)
        {
            iDraw = UnityEngine.Random.Range(0, h.Length);

            DieLogic.moveDie(h[iDraw], supportT);
            h[iDraw].toggleVisibility(true);

            SoundControl.instance.playAudio("dice", "slide");

            count--;
            h = gameLayout.getDiceInZone(supply);

            if (count > 0 && h.Length == 0 && d.Length > 0)
            {
                //yield return new WaitForSeconds(h[iDraw].GetComponent<AudioSource>().clip.length);
                moveDice(stored, supply, false);
                h = gameLayout.getDiceInZone(supply);
                d = new Die[0];
            }
        }

        Debug.Log("Moved " + (amount - count) + " dice !");
        GameState.hasDrawn = true;
    }
Esempio n. 3
0
    public void adminMoveDie()
    {
        //Transform dT;
        Transform zT = GameObject.Find("areaPlayer1/zoneSupport").transform;
        Transform dT = GameObject.Find("areaPlayer1/zoneSupport").transform;

        switch (stepLogic.cStep)
        {
        case 0:
            dT = GameObject.Find("areaPlayer1/zoneSupport").transform;
            zT = GameObject.Find("areaPlayer1/zoneServicable").transform;
            break;

        case 1:
            dT = GameObject.Find("areaPlayer1/zoneServicable").transform;
            zT = GameObject.Find("areaPlayer1/zoneSummoned").transform;
            break;

        case 2:
            dT = GameObject.Find("areaPlayer1/zoneSummoned").transform;
            zT = GameObject.Find("areaPlayer1/zoneSpent").transform;
            break;

        case 3:
            dT = GameObject.Find("areaPlayer1/zoneSpent").transform;
            zT = GameObject.Find("areaPlayer1/zoneStored").transform;
            break;

        case 4:
            dT = GameObject.Find("areaPlayer1/zoneStored").transform;
            zT = GameObject.Find("areaPlayer1/zoneSupport").transform;
            break;

        case 5:
            dT = GameObject.Find("areaPlayer1/zoneSupport").transform;
            zT = GameObject.Find("areaPlayer1/zoneSupport").transform;
            break;
        }

        foreach (Die die in dT.GetComponentsInChildren <Die>())
        {
            /*
             * item.GetComponent<Draggable3D_Plane>().transform.SetParent(zT.Find("Dice"));
             * float offsetX = UnityEngine.Random.Range(-.05f, .05f);
             * float offsetY = UnityEngine.Random.Range(-.05f, .05f);
             * item.transform.localPosition = new Vector3(offsetX, offsetY, -.01f);
             */
            DieLogic.moveDie(die, zT.GetComponentInChildren <Zone>());
        }

        adminIncStep();
    }