예제 #1
0
    public IEnumerator Goto(GameObject objectPion, int c)
    {
        PionScript pion = objectPion.GetComponent <PionScript>();

        cases[pion.getPosition2()].isGone(objectPion);
        int     trancheC = tranche(c);
        Vector3 newPionPosition;
        int     tranchePos = tranche(pion.getPosition2());


        while (trancheC != tranchePos)
        {
            tranchePos = (tranchePos + 1) % 4;

            pion.seDeplacer(tranchePos * 10 % 40);

            // pion.position ==0 ajouter 100

            newPionPosition = cases[pion.getPosition2()].getNewPionPositionPassage();
            while (objectPion.transform.localPosition != newPionPosition)
            {
                objectPion.transform.localPosition = Vector2.MoveTowards(objectPion.transform.localPosition,
                                                                         newPionPosition, pion.speed * Time.deltaTime);
                yield return(new WaitForEndOfFrame());
            }
        }

        newPionPosition = cases[c].getNewPionPosition(objectPion);
        while (objectPion.transform.localPosition != newPionPosition)
        {
            objectPion.transform.localPosition = Vector2.MoveTowards(objectPion.transform.localPosition,
                                                                     newPionPosition, pion.speed * Time.deltaTime);
            yield return(new WaitForEndOfFrame());
        }
        yield return(new WaitForEndOfFrame());

        yield return(affichercarte(c));
    }
예제 #2
0
    public void tirerCarte(PionScript j)
    {
        Debug.Log(carteChance[curseur]);

        if (vérif && curseur == 3)
        {
            curseur++;
        }

        if (curseur == 0)
        {
            j.crediter(50);
        }
        else if (curseur == 1)
        {
            j.setPosition2(39);
        }
        else if (curseur == 2)
        {
            j.seDeplacer(-3);
        }
        else if (curseur == 3)
        {
            j.setNombreCarteLibererPrisonChance(1);
            vérif = true;
        }
        else if (curseur == 4)
        {
            j.débiter(j.getNomberMosain() * 25 + j.getNomberHotel() * 100);
        }
        else if (curseur == 5)
        {
            j.crediter(100);
        }
        else if (curseur == 6)
        {
            j.débiter(15);
        }
        else if (curseur == 7)
        {
            j.crediter(150);
        }
        else if (curseur == 8)
        {
            j.débiter(150);
        }
        else if (curseur == 9)
        {
            j.setPosition2(24);
        }
        else if (curseur == 10)
        {
            j.allezEnPrison();
        }
        else if (curseur == 11)
        {
            j.débiter(j.getNomberMosain() * 40 + j.getNomberHotel() * 115);
        }
        else if (curseur == 12)
        {
            j.débiter(20);
        }
        else if (curseur == 13)
        {
            j.setPosition2(15);
        }
        else if (curseur == 14)
        {
            j.setPosition2(0);
        }
        else if (curseur == 15)
        {
            j.setPosition2(11);
        }

        curseur = (curseur + 1) % 16;
    }