Exemplo n.º 1
0
    private void generateRepere(RepereType repereType, Transform reperePosition)
    {
        Quaternion repereRotation = reperePosition.rotation;
        GameObject repereObject   = (GameObject)Instantiate(repereType.gameObject, reperePosition.position, repereRotation);

        repereObject.transform.parent = reperePosition;
    }
Exemplo n.º 2
0
 private void setColorsOfChoiceButtons()
 {
     for (int i = 0; i < 4; ++i)
     {
         RepereType repereType = ReperesManager.Instance.getRepereTypeWithIndex(i);
         setColorOfChoiceButton(diceColorChoiceButtons[i], repereType.getTypeCouleurValue());
     }
 }
Exemplo n.º 3
0
    public void onChosenRepereCardinal(RepereType.TypePointCardinal cardinalType)
    {
        RepereType repere     = ReperesManager.Instance.getCardinalRepereType(cardinalType);
        string     repereInfo = repere.getTypePointCardinalValue(false);

        setDiceCardinalLabel(diceCardinal1Value, repereInfo);

        diceCardinalChoose.SetActive(false);
        diceCardinalChooseWindow.SetActive(false);
        diceCardinalPass.SetActive(false);
    }
Exemplo n.º 4
0
 private void initReperes()
 {
     if (RepereType.getTypeForCurrentGame() == RepereType.TypeEnum.Couleur)
     {
         initReperesWithRandomColors();
     }
     else
     {
         initReperesWithRandomPointCardinal();
     }
 }
Exemplo n.º 5
0
    private void initReperesWithRandomPointCardinal()
    {
        int pointCardinalHautValue   = UnityEngine.Random.Range(0, RepereType.NB_TYPE_REGULIER);
        int pointCardinalDroiteValue = (pointCardinalHautValue + 1) % RepereType.NB_TYPE_REGULIER;
        int pointCardinalBasValue    = (pointCardinalHautValue + 2) % RepereType.NB_TYPE_REGULIER;
        int pointCardinalGaucheValue = (pointCardinalHautValue + 3) % RepereType.NB_TYPE_REGULIER;

        repereHaut   = reperesPerCard[(RepereType.TypePointCardinal)pointCardinalHautValue];
        repereDroite = reperesPerCard[(RepereType.TypePointCardinal)pointCardinalDroiteValue];
        repereBas    = reperesPerCard[(RepereType.TypePointCardinal)pointCardinalBasValue];
        repereGauche = reperesPerCard[(RepereType.TypePointCardinal)pointCardinalGaucheValue];
    }
Exemplo n.º 6
0
    private void initReperesWithRandomColors()
    {
        RepereType.TypeCouleur[] colors = new RepereType.TypeCouleur[RepereType.NB_TYPE_REGULIER];
        for (int i = 0; i < RepereType.NB_TYPE_REGULIER; ++i)
        {
            colors[i] = (RepereType.TypeCouleur)i;
        }
        colors.ShuffleFY();

        repereHaut   = reperesPerColor[colors[0]];
        repereDroite = reperesPerColor[colors[1]];
        repereBas    = reperesPerColor[colors[2]];
        repereGauche = reperesPerColor[colors[3]];
    }
Exemplo n.º 7
0
 private void checkDiceReperes()
 {
     if (RepereType.getTypeForCurrentGame() == RepereType.TypeEnum.Couleur)
     {
         if ((targetRepere1 != null) && targetRepere1.hasRegularValue())
         {
             onDiceRepereDone();
         }
     }
     else
     {
         if ((targetRepere2 != null) && targetRepere2.hasRegularValue())
         {
             onDiceRepereDone();
         }
     }
 }
Exemplo n.º 8
0
 private void getDirectionToTarget(RepereType repere, out PathChecker.PathDirection direction)
 {
     if (repere == ReperesManager.Instance.repereBas)
     {
         direction = PathChecker.PathDirection.Down;
     }
     else if (repere == ReperesManager.Instance.repereHaut)
     {
         direction = PathChecker.PathDirection.Up;
     }
     else if (repere == ReperesManager.Instance.repereGauche)
     {
         direction = PathChecker.PathDirection.Left;
     }
     else
     {
         direction = PathChecker.PathDirection.Right;
     }
 }
Exemplo n.º 9
0
    private void launchDiceReperes()
    {
        int  repereRandomIndex = Random.Range(0, RepereType.NB_TYPE_TOUS);
        bool repereRegulier    = repereRandomIndex < RepereType.NB_TYPE_REGULIER;

        targetRepere1 = repereRegulier ? ReperesManager.Instance.getRepereTypeWithIndex(repereRandomIndex) : null;

        if (RepereType.getTypeForCurrentGame() == RepereType.TypeEnum.Couleur)
        {
            targetRepere1IsTreasure = false;
            RepereType.TypeCouleur repereType;
            Color repereColor;

            if (repereRegulier)
            {
                repereType  = targetRepere1.typeCouleur;
                repereColor = targetRepere1.getTypeCouleurValue();
            }
            else
            {
                repereType  = (RepereType.TypeCouleur)repereRandomIndex;
                repereColor = RepereType.getTypeCouleurValue(repereType);
            }

            DicesManager.Instance.setDiceColorForRepere(repereType, repereColor);
        }
        else
        {
            RepereType.TypePointCardinal repereType1;
            RepereType.TypePointCardinal repereType2;
            string repereInfo1;
            string repereInfo2;

            if (repereRegulier)
            {
                repereType1             = targetRepere1.typePointCardinal;
                repereInfo1             = targetRepere1.getTypePointCardinalValue(true);
                targetRepere1IsTreasure = false;
            }
            else
            {
                repereType1             = (RepereType.TypePointCardinal)repereRandomIndex;
                repereInfo1             = RepereType.getTypePointCardinalValue(repereType1, true);
                targetRepere1IsTreasure = repereType1 == RepereType.TypePointCardinal.Special;
            }

            repereRandomIndex = Random.Range(0, RepereType.NB_TYPE_TOUS);
            repereRegulier    = repereRandomIndex < RepereType.NB_TYPE_REGULIER;

            if (repereRegulier)
            {
                targetRepere2 = ReperesManager.Instance.getRepereTypeWithIndex(repereRandomIndex);
                repereType2   = targetRepere2.typePointCardinal;
                repereInfo2   = targetRepere2.getTypePointCardinalValue(false);
            }
            else
            {
                repereType2 = (RepereType.TypePointCardinal)repereRandomIndex;
                repereInfo2 = RepereType.getTypePointCardinalValue(repereType2, false);
            }

            DicesManager.Instance.setDiceCardinalForReperes(repereType1, repereType2, repereInfo1, repereInfo2);
        }

        checkDiceReperes();
    }
Exemplo n.º 10
0
 public void setDiceRepere2WithCardinal(RepereType.TypePointCardinal cardinalType)
 {
     targetRepere2 = ReperesManager.Instance.getCardinalRepereType(cardinalType);
     onDiceRepereDone();
 }
Exemplo n.º 11
0
 public void setDiceRepere1WithIndex(int index)
 {
     targetRepere1           = ReperesManager.Instance.getRepereTypeWithIndex(index);
     targetRepere1IsTreasure = false;
     onDiceRepereDone();
 }
Exemplo n.º 12
0
    public void onChosenRepereColorWithIndex(int index)
    {
        RepereType repere = ReperesManager.Instance.getRepereTypeWithIndex(index);

        setDiceColorForRepere(repere.typeCouleur, repere.getTypeCouleurValue());
    }