Пример #1
0
    public void DisplayRoll(GameObject target, bool display, DiceFace face = null)
    {
        if (!display && target.transform.Find("RollView") != null)
        {
            Destroy(target.transform.Find("RollView").gameObject);
        }
        else if (display)
        {
            GameObject newObject = Instantiate(diceFacePrefab, new Vector3(0, 0, -1), Quaternion.identity);
            newObject.transform.SetParent(target.transform);
            newObject.transform.localScale    = new Vector3(0.16f, 0.19f, 0);
            newObject.transform.localPosition = new Vector3(0, 0, 0);
            newObject.name = "RollView";

            newObject.transform.Find("Text").GetComponent <Text>().text = (face.faceName != null)? face.faceName: face.value + "";
            foreach (Sprite aSpr in face.mySprites)
            {
                GameObject newLayer = Instantiate(newObject.transform.Find("DiceLayer").gameObject);
                newLayer.transform.SetParent(newObject.transform);
                newLayer.transform.localScale    = new Vector3(1, 1, 0);
                newLayer.transform.localPosition = new Vector3(0, 0, 0);
                newLayer.transform.SetSiblingIndex(0);

                newLayer.GetComponent <Image>().sprite = aSpr;
                newLayer.SetActive(true);
            }

            newObject.SetActive(true);
        }
    }
Пример #2
0
        private void PerformRollCalculations(DiceFace face)
        {
            switch (face)
            {
            case DiceFace.Shotgun:
                _lives--;
                break;

            case DiceFace.Brain:
                _score++;
                break;

            case DiceFace.Runner:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(face), face, null);
            }

            this.lbl_Score.Text = $@"Score: {_score}";
            this.lbl_Lives.Text = $@"Lives: {_lives}";

            if (_lives <= 0)
            {
                this.btn_Roll.Enabled = false;
            }
        }
Пример #3
0
    public Dice GenerateUpgrades(DiceFace toUpgrade)
    {
        Dice improvedDice = new Dice(null, new List <int>(), new List <string>(), null);

        improvedDice.myItem = currentlySelectedItem.myItemRef;

        // Adding 1 : solution by default
        DiceFace newFace = new DiceFace(toUpgrade);

        newFace.value++;
        improvedDice.myFaces.Add(newFace);
        improvedDice.myOwner = thePlayer;

        // Adding other effects
        List <string> otherEffets = new List <string>();

        foreach (DiceFace aFace in currentlySelectedItem.myItemRef.myDice.myFaces)
        {
            foreach (Effect eff in aFace.effects)
            {
                if (!otherEffets.Contains(eff.nameEffect) && !toUpgrade.myEffectNames().Contains(eff.nameEffect) && eff.nameEffect != "Cursed")
                {
                    otherEffets.Add(eff.nameEffect);
                    newFace = new DiceFace(toUpgrade);
                    newFace.effects.Add(new Effect(eff));
                    improvedDice.myFaces.Add(newFace);
                }
            }
        }

        return(improvedDice);
    }
Пример #4
0
 // May need to refactor all those constructors
 public Dice(List <string> fNames, List <int> fValues, List <string> fEffects, List <int> fEffectsValues)
 {
     if (fNames != null && fNames.Count > 0)
     {
         for (int i = 0; i < fNames.Count; i++)
         {
             DiceFace newFace = new DiceFace(fNames[i]);
             newFace.value = fValues[i];
             myFaces.Add(newFace);
         }
     }
     else if (fValues != null)
     {
         for (int i = 0; i < fValues.Count; i++)
         {
             DiceFace   newFace = new DiceFace(fValues[i]);
             List <int> effVal  = new List <int>();  if (fEffectsValues != null && fEffectsValues.Count > 0)
             {
                 effVal.Add(fEffectsValues[i]);
             }
             if (fEffects.Count > 0 && fEffects[i] != "")
             {
                 newFace.effects.Add(new Effect(fEffects[i], -1, null, effVal));
             }
             myFaces.Add(newFace);
         }
     }
 }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        State           = TurnState.Draw;
        m_CurrentPlayer = 0;
        DiceObject        diceObject = Resources.Load <DiceObject>("Prefabs/Dice");
        List <DiceObject> dice       = new List <DiceObject>();

        SpriteLoader.Load();
        DiceFaceLoader.Load();

        DiceFace[] faces = new DiceFace[6];
        for (int i = 1; i < 7; i++)
        {
            faces[i - 1] = DiceFaceLoader.Get("DebugCat-" + i); //new PlayFace(i, i, i, FaceType.Play, Color.black, Color.cyan, "DEFAULT-" + i, MaterialLoader.Get("DebugCat"));
            DiceFaceLoader.Serialise(faces[i - 1]);
        }

        for (int i = 0; i < 18; i++)
        {
            DiceObject instance = GameObject.Instantiate <DiceObject>(diceObject);
            instance.SetFaces(faces);
            instance.transform.position = new Vector3(-10.0f, 2.0f, -10.0f);
            instance.GetComponent <Rigidbody>().isKinematic = true;
            dice.Add(instance);
        }
        m_Players = new List <BasePlayer>();
        CreatePlayer(dice, typeof(ControllingPlayer));
    }
Пример #6
0
    public void HideSprite()
    {
        Sprite resSprite = Resources.Load <Sprite>("Images/UI_Mask.png");

        GetComponent <Image>().sprite = resSprite;
        DisplayRarityGem(false);

        myItemRef = null; myFaceRef = null; // Risqué
    }
Пример #7
0
        /**
         * <summary>
         * A simple shortcut to GetResult. It creates the
         * dice roll instance itself and return a DiceResult
         * </summary>
         */
        public static DiceResult Roll(
            DiceFace face        = DiceFace.Six,
            int modifier         = 0,
            int criticalModifier = 1
            )
        {
            DiceRoll roll = new DiceRoll(face, modifier, criticalModifier);

            return(GetResult(roll));
        }
Пример #8
0
 private void ShowDice(IList <int> results, DiceType dice)
 {
     this.DiceResults.Controls.Clear();
     foreach (var die in results)
     {
         var face = new DiceFace();
         face.Height = face.Width = this.DiceResults.Height > 200 ? 200 : this.DiceResults.Height - 10;
         face.SetNumber(dice, die);
         this.DiceResults.Controls.Add(face);
     }
 }
Пример #9
0
 public DiceFace(DiceFace toCopy)
 {
     value = toCopy.value; upgradeCost = toCopy.upgradeCost; faceName = toCopy.faceName;
     foreach (Effect eff in toCopy.effects)
     {
         effects.Add(new Effect(eff));
     }
     foreach (Sprite elt in toCopy.mySprites)
     {
         mySprites.Add(elt);
     }
 }
Пример #10
0
    public static void Serialise(DiceFace faceRef)
    {
        FaceInfo info = new FaceInfo(faceRef);

        string content = JsonUtility.ToJson(info, true);

        StreamWriter writer = new StreamWriter(DIR + "/" + faceRef.Name + "-" + faceRef.Level + ".json");

        writer.Write(content);
        writer.Flush();
        writer.Close();
    }
Пример #11
0
 public bool SetFace(int serial, DiceFace value)
 {
     if (serial < faces.Count)
     {
         faces[serial] = value;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #12
0
    public FaceInfo(DiceFace faceRef)
    {
        if (faceRef.Face == FaceType.Play)
        {
            PlayFace newFace = (PlayFace)faceRef;

            Level      = newFace.Level;
            Face       = newFace.Face;
            TextColour = newFace.TextColour;
            DieColour  = newFace.DieColour;
            Name       = newFace.Name;

            Attack    = newFace.Attack;
            Toughness = newFace.Toughness;

            SpecialName = "None";

            if (newFace.Image != null)
            {
                SpriteName = newFace.Image.name;
            }
            else
            {
                SpriteName = "None";
            }
        }
        else if (faceRef.Face == FaceType.Special)
        {
            SpecialFace newFace = (SpecialFace)faceRef;

            Level      = newFace.Level;
            Face       = newFace.Face;
            TextColour = newFace.TextColour;
            DieColour  = newFace.DieColour;
            Name       = newFace.Name;

            Attack    = 0;
            Toughness = 0;

            SpecialName = newFace.Special.Name;

            if (newFace.Image != null)
            {
                SpriteName = newFace.Image.name;
            }
            else
            {
                SpriteName = "None";
            }
        }
    }
Пример #13
0
    public void BuyFace(DiceFace aFace)
    {
        thePlayer.myInfo.gold -= aFace.upgradeCost * (int)Mathf.Pow(2, currentlySelectedItem.myItemRef.myInfo.improved);
        currentlySelectedItem.myItemRef.myInfo.improved++;

        int replaceInd = currentlySelectedItem.myItemRef.myDice.myFaces.IndexOf(currentlySelectedFace.myFaceRef);

        aFace.upgradeCost += (aFace.value != currentlySelectedItem.myItemRef.myDice.myFaces[replaceInd].value) ?10:0;
        currentlySelectedItem.myItemRef.myDice.myFaces[replaceInd] = aFace;

        thePlayer.myGold.GetComponent <Text>().text = thePlayer.myInfo.gold + "";
        NullifySelected();
        DisplayItemCollection();
    }
Пример #14
0
        public void SetFace(DiceFace face, double cameraDistance = 2.2)
        {
            switch (face)
            {
            case DiceFace.One:
                Camera.Position      = new Point3D(0, 0, -cameraDistance); //setting the camera position in world coordinates
                Camera.LookDirection = new Vector3D(0, 0, 1);              //defininig the direction in which the camera looking in world coordinates
                Camera.UpDirection   = new Vector3D(0, 1, 0);
                myDLight.Direction   = new Vector3D(0, 0, 1);
                break;

            case DiceFace.Two:
                Camera.Position      = new Point3D(-cameraDistance, 0, 0); //setting the camera position in world coordinates
                Camera.LookDirection = new Vector3D(1, 0, 0);              //defininig the direction in which the camera looking in world coordinates
                Camera.UpDirection   = new Vector3D(0, 1, 0);
                myDLight.Direction   = new Vector3D(1, 0, 0);
                break;

            case DiceFace.Three:
                Camera.Position      = new Point3D(0, cameraDistance, 0); //setting the camera position in world coordinates
                Camera.LookDirection = new Vector3D(0, -1, 0);            //defininig the direction in which the camera looking in world coordinates
                Camera.UpDirection   = new Vector3D(-1, 0, 0);
                myDLight.Direction   = new Vector3D(0, -1, 0);
                break;

            case DiceFace.Four:
                Camera.Position      = new Point3D(0, -cameraDistance, 0); //setting the camera position in world coordinates
                Camera.LookDirection = new Vector3D(0, 1, 0);              //defininig the direction in which the camera looking in world coordinates
                Camera.UpDirection   = new Vector3D(1, 0, 0);
                myDLight.Direction   = new Vector3D(0, 1, 0);
                break;

            case DiceFace.Five:
                Camera.Position      = new Point3D(cameraDistance, 0, 0); //setting the camera position in world coordinates
                Camera.LookDirection = new Vector3D(-1, 0, 0);            //defininig the direction in which the camera looking in world coordinates
                Camera.UpDirection   = new Vector3D(0, 1, 0);
                myDLight.Direction   = new Vector3D(-1, 0, 0);
                break;

            case DiceFace.Six:
                Camera.Position      = new Point3D(0, 0, cameraDistance); //setting the camera position in world coordinates
                Camera.LookDirection = new Vector3D(0, 0, -1);            //defininig the direction in which the camera looking in world coordinates
                Camera.UpDirection   = new Vector3D(0, 1, 0);
                myDLight.Direction   = new Vector3D(0, 0, -1);
                break;
            }
        }
Пример #15
0
 public DiceFace getFaceSummary(DiceFace aFace)
 {
     if (aFace.alreadySummarized)
     {
         return(aFace);
     }
     else if (!isConditionDice)
     {
         return(getCopyFaceSummary(aFace));
     }
     else // it is a Condition Dice
     {
         aFace.mySprites = new List <Sprite>();
         aFace.mySprites.Add(Resources.Load <Sprite>("Images/Condition_" + aFace.faceName.ToLower() + ".png"));
         return(aFace);
     }
 }
Пример #16
0
        private static DiceFace RollOneDice()
        {
            double   threshold   = 0;
            double   rolledValue = new Random().NextDouble();
            DiceFace rolledFace  = _clrOutcomes[0].Outcome;

            foreach (var outcome in _clrOutcomes)
            {
                threshold += outcome.Probability;
                if (rolledValue <= threshold)
                {
                    rolledFace = outcome.Outcome;
                    break;
                }
            }

            return(rolledFace);
        }
Пример #17
0
    public void FinalizeFaceSimulation(DiceFace aFace) // everything is already setup, just need to apply post-simulation effects
    {
        List <string> nameEffects = new List <string>();

        aFace.effects.ForEach(x => nameEffects.Add(x.nameEffect));

        foreach (Effect eff in externalEffects)
        {
            if (eff.nameEffect == "LightPoison_If_Lowest" && simulatedStats["Lowest"] == aFace.value && nameEffects.Contains("Hit"))
            {
                aFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_LightPoison.png"));
                aFace.effects.Add(new Effect("LightPoison", -1, null, new List <int> {
                    eff.effectValues[0]
                }));
            }
        }
        aFace.mySprites.Reverse();
    }
        /// <summary>
        /// This method is called when the rolling of dice is completed. So, we can set a new random face to the dice.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DiceAnimation_Completed(object sender, EventArgs e)
        {
            if (bIsDiceClicked == true)
            {
                bIsDiceClicked = false;

                Random diceRandom = new Random();

                currentFace = (DiceFace)diceRandom.Next(1, 7);
                GameDice.SetFace(currentFace);

                int nextPos = Tokens[(int)_currentToken].CurrentPosition;
                if ((Tokens[(int)_currentToken].CanMove == false && (int)currentFace == 6))
                {
                    Tokens[(int)_currentToken].CanMove = true;
                    bIsTokenMoved = true;
                }
                else if (Tokens[(int)_currentToken].CanMove == true)
                {
                    if (nextPos + (int)currentFace > 100)
                    {
                        bIsTokenMoved = false;
                    }
                    else
                    {
                        nextPos       = nextPos + (int)currentFace;
                        bIsTokenMoved = true;
                    }
                }

                Point dest;
                if (nextPos == 0)
                {
                    dest = Tokens[(int)_currentToken].StartPoint;
                }
                else
                {
                    dest = GameBoard.GetCenterCoordinates(nextPos);
                }

                Tokens[(int)_currentToken].CurrentPosition = nextPos;
                Tokens[(int)_currentToken].MoveTo(dest.X, dest.Y);
            }
        }
Пример #19
0
    public override List <DiceFace> getAttack()
    {
        List <DiceFace> values = new List <DiceFace>();

        if (myLeftHand.equippedItem == null && myRightHand.equippedItem == null)
        {
            values.Add(myBaseAttackDice.rollDice());
        }
        else
        {
            foreach (EquipSlot elt in new List <EquipSlot> {
                myLeftHand, myRightHand
            })
            {
                if (elt.equippedItem != null)
                {
                    DiceFace tryFace = elt.equippedItem.myDice.rollDice();
                    if (elt == myRightHand)
                    {
                        if (elt.equippedItem.myDice.GetMinValue() <= 6)
                        {
                            while (tryFace.value > 6)
                            {
                                tryFace = elt.equippedItem.myDice.rollDice();
                            }
                        }
                        else
                        {
                            tryFace = myBaseAttackDice.rollDice();
                        }
                    }
                    values.Add(tryFace);
                }
            }
        }

        if (myNecklace.equippedItem != null && myNecklace.equippedItem.myDice != null)
        {
            values.Add(myNecklace.equippedItem.myDice.rollDice());
        }
        return(values);
    }
        /// <summary>
        /// This is the constructor for the mainwindow. Here we will initialize all the variables that we are going to use throughout the application.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            //Initial face
            currentFace = DiceFace.Three;
            _ladders    = new List <Ladder>();
            _snakes     = new List <Snake>();
            _tokens     = new List <Token>();

            //This is the data that will be saved to reproduce the gameboard.
            _ladderNumbers = new Dictionary <int, int>();
            _snakeNumbers  = new Dictionary <int, int>();

            _SnakeTailBoxColor   = Brushes.PaleVioletRed;
            _SnakeHeadBoxColor   = Brushes.DarkRed;
            _LadderEndBoxColor   = Brushes.DarkGreen;
            _LadderStartBoxColor = Brushes.LawnGreen;
            _SnakeColor          = Brushes.Red;
            _LadderColor         = Brushes.Black;

            _intMaxLadderLength            = 60;
            _intMaxSnakeLength             = 80;
            _dbSnakeThicknessFactor        = 40.0;
            _intNumberOfSnakes             = 5;
            _intNumberOfLadders            = 5;
            _bCanSnakesAndLaddersIntersect = true;
            LoadSettings();

            CurrentToken = enGameToken.Green;
            DataContext  = this;
            GameDice.DiceAnimation.Completed += DiceAnimation_Completed;
            _LadderSnakeRandom = new Random();

            DiceCanvas.IsEnabled           = false;
            CreateBoardButton.IsEnabled    = true;
            StartGameButton.IsEnabled      = false;
            PlayerSelectionPanel.IsEnabled = true;
            StopGameButton.IsEnabled       = false;

            _GameRulesText = "Rules of the game:\n1. The colored tokens will start moving once you score first six.\n2. The token which reaches 100 first wins the game.\n3. If you reach to the number where snake head is, you will have to go to the snake tail position.\n4. If you reach to the number where ladder starts, you will reach to the higher end of the ladder.";
        }
Пример #21
0
    public void DisplayConditions()
    {
        Dice myDiceConditions = new Dice(new List <string>());

        myDiceConditions.isConditionDice = true;

        DiceFace aFace;

        foreach (Effect eff in myConditions)
        {
            if (eff.nameEffect != null && eff.nameEffect != "")
            {
                aFace = new DiceFace(eff.nameEffect);

                if (new List <string> {
                    "Weak", "LightPoison"
                }.Contains(eff.nameEffect))
                {
                    aFace.value = eff.duration;
                }
                if (new List <string> {
                    "Vulnerable"
                }.Contains(eff.nameEffect))
                {
                    aFace.value = eff.effectValues[0];
                }

                myDiceConditions.myFaces.Add(aFace);
            }
        }
        if (myInfo.immunities != null)
        {
            foreach (string name in myInfo.immunities)
            {
                aFace = new DiceFace("Immune" + name);
                myDiceConditions.myFaces.Add(aFace);
            }
        }

        myConditionsDisplayer.DisplayDice(myDiceConditions);
    }
Пример #22
0
        private void UpdateRolledDice(int diceIndex, DiceFace face, Color diceColor)
        {
            switch (diceIndex)
            {
            case 0:
                btn_Dice1.BackColor       = diceColor;
                btn_Dice1.BackgroundImage = face switch
                {
                    DiceFace.Runner => Resources.runner,
                    DiceFace.Shotgun => Resources.shotgun,
                    DiceFace.Brain => Resources.brain
                };
                btn_Dice1.Tag = face;
                break;

            case 1:
                btn_Dice2.BackColor       = diceColor;
                btn_Dice2.BackgroundImage = face switch
                {
                    DiceFace.Runner => Resources.runner,
                    DiceFace.Shotgun => Resources.shotgun,
                    DiceFace.Brain => Resources.brain
                };
                btn_Dice2.Tag = face;
                break;

            case 2:
                btn_Dice3.BackColor       = diceColor;
                btn_Dice3.BackgroundImage = face switch
                {
                    DiceFace.Runner => Resources.runner,
                    DiceFace.Shotgun => Resources.shotgun,
                    DiceFace.Brain => Resources.brain
                };
                btn_Dice3.Tag = face;
                break;
            }
        }
Пример #23
0
 /**
  * <summary>
  * Create a dice roll by sending some basic data on it.
  * </summary>
  */
 public DiceRoll(DiceFace _face = DiceFace.Six, int _modifier = 0, int _criticalModifier = 1)
 {
     face             = _face;
     modifier         = _modifier;
     criticalModifier = _criticalModifier;
 }
Пример #24
0
    public DiceFace getCopyFaceSummary(DiceFace aFace)
    {
        DiceFace finalFace = new DiceFace(aFace.value);

        finalFace.faceName = aFace.faceName;

        //Get all effects that apply to the face : global, from item and from face
        List <Effect> allEffects = new List <Effect>();

        allEffects.AddRange(aFace.effects);
        allEffects.AddRange(externalEffects);

        if (allEffects.Count > 1)
        {
            allEffects.Sort(delegate(Effect a, Effect b) { return(GetEffectPriority(a.nameEffect).CompareTo(GetEffectPriority(b.nameEffect))); });
        }

        foreach (Effect eff in allEffects)
        {
            // Effets de transformation
            if (eff.nameEffect == "Transform" && finalFace.value == eff.effectValues[0])
            {
                finalFace.value = eff.effectValues[1];
                finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_transformed.png"));
            }
            else if (eff.nameEffect == "Weak")
            {
                finalFace.value--;
                finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_reduced.png"));
            }
            else if (eff.nameEffect == "Strength")
            {
                finalFace.value += eff.effectValues[0];
                finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_augmented.png"));
            }
            else if (new List <string> {
                "Cursed"
            }.Contains(eff.nameEffect))
            {
                finalFace.value += eff.effectValues[0];
                finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_Cursed.png"));
            }
            // Effets de tests
            else if (eff.nameEffect == "Heals_If_Threshold")
            {
                if (finalFace.value >= eff.effectValues[0])
                {
                    finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_success.png"));
                    finalFace.effects.Add(new Effect("Heal", -1, "face", new List <int> {
                        eff.effectValues[1]
                    }));
                }
            }
            // Effets de conditions sans paramètre
            else if (new List <string> {
                "Hit", "Weakening", "Vulnerability"
            }.Contains(eff.nameEffect))
            {
                finalFace.effects.Add(new Effect(eff.nameEffect, -1, null, null)); // to be improved
                finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_" + eff.nameEffect.ToLower() + ".png"));
            }
            // Effets de conditions avec paramètre
            else if (new List <string> {
                "LightPoison"
            }.Contains(eff.nameEffect))
            {
                finalFace.effects.Add(new Effect(eff.nameEffect, -1, null, eff.effectValues.GetRange(0, 1))); // to be improved
                finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_" + eff.nameEffect.ToLower() + ".png"));
            }
            // Faces de dés nommées
            else if (!(new List <string> {
                "LightPoison_If_Lowest"
            }.Contains(eff.nameEffect)))
            {
                finalFace.effects.Add(new Effect(eff.nameEffect, -1, null, null));
            }
        }

        if (aFace.faceName != null)
        {
            finalFace.mySprites.Add(Resources.Load <Sprite>("Images/Dice_blue.png"));
        }
        finalFace.alreadySummarized = true;
        return(finalFace);
    }
Пример #25
0
    public void DisplayDice(Dice dice)
    {
        bool       isUpgraded = basicPrefab.name == "ImprovedBuyGroup";
        List <int> coordinates;

        Hide();

        List <DiceFace> simulation = dice.GetAllFinalFaces();
        int             count = 0; int countMax = dice.myFaces.Count - 1;

        while (count <= countMax)
        //foreach (DiceFace face in dice.myFaces)
        {
            //DiceFace finalFace = dice.getFaceSummary(face);
            DiceFace face = dice.myFaces[count]; DiceFace finalFace = simulation[count];

            coordinates = getFaceCoordinates(count, (int)rowLength, dice.faceSplits);

            GameObject newObject = Instantiate(basicPrefab, new Vector3(0, 0, -1), Quaternion.identity);
            newObject.transform.SetParent(basicPrefab.transform.parent);
            newObject.transform.localScale    = basicPrefab.transform.localScale;
            newObject.transform.localPosition = basicPrefab.transform.localPosition + new Vector3(0 + coordinates[0] * xStep, 0 - coordinates[1] * yStep, 0);
            if (newObject.GetComponent <InteractableElt>() != null)
            {
                newObject.GetComponent <InteractableElt>().myFaceRef = face;
            }                                                                                                                      // for upgradeHandler

            // Test dans le cas d'un superprefab Upgrade ou d'un ConditionDice
            if (!isUpgraded && !dice.isConditionDice)
            {
                newObject.transform.Find("Text").GetComponent <Text>().text = (face.faceName != null) ? face.faceName : finalFace.value + "";
            }
            else if (!dice.isConditionDice)
            {
                newObject.transform.Find("DiceFacePrefab").Find("Text").GetComponent <Text>().text = finalFace.value + "";
                newObject.transform.Find("Button").GetComponent <InteractableElt>().myFaceRef      = face;
                newObject.transform.Find("Button").Find("Text").GetComponent <Text>().text         = "Buy : " + (face.upgradeCost * Mathf.Pow(2, dice.myItem.myInfo.improved)) + " gold";
                newObject.transform.Find("Button").GetComponent <Button>().interactable            = dice.myOwner.myInfo.gold >= (face.upgradeCost * Mathf.Pow(2, dice.myItem.myInfo.improved));
            }
            else if (face.value != 0) // ConditionDice with value. Il doit y avoir un moyen de factoriser
            {
                newObject.transform.Find("Text").GetComponent <Text>().text = finalFace.value + "";
                newObject.transform.Find("Text").gameObject.SetActive(true);
            }

            foreach (Sprite aSpr in finalFace.mySprites)
            {
                Transform objectParent = isUpgraded ? newObject.transform.Find("DiceFacePrefab") : newObject.transform;

                GameObject newLayer = Instantiate(objectParent.Find("DiceLayer").gameObject);
                newLayer.transform.SetParent(objectParent);
                newLayer.transform.localScale    = objectParent.Find("DiceLayer").localScale;
                newLayer.transform.localPosition = new Vector3(0, 0, 0);
                newLayer.transform.SetSiblingIndex(0);

                newLayer.GetComponent <Image>().sprite = aSpr;
                newLayer.SetActive(true);
            }

            newObject.SetActive(true);

            displayedList.Add(newObject);

            count++;
        }
    }