Пример #1
0
 // UI -------------------------
 public void ChangeDiceType()
 {
     if (diceType != (dice_types)diceTypeUI.value)
     {
         diceType = (dice_types)diceTypeUI.value;
         RecalculatePresentDice();
     }
 }
Пример #2
0
    // Start is called before the first frame update
    void Awake()
    {
        gravityGround = GameObject.Find("Bowl_Wall_0");

        camera         = GameObject.Find("ARCamera");
        diceTypeUI     = GameObject.Find("Dice_Type_Dropdown").GetComponent <Dropdown>();
        diceModeUI     = GameObject.Find("Dice_Mode_Dropdown").GetComponent <Dropdown>();
        diceNumUI      = GameObject.Find("Dice_Amount").GetComponent <InputField>();
        diceModifierUI = GameObject.Find("Dice_Modifier").GetComponent <InputField>();

        rollTextComp     = GameObject.Find("Roll_Result").GetComponent <Text>();
        rollTextMeshComp = GetComponent <TextMesh>();

        if (diceTypeUI != null)
        {
            diceType = (dice_types)diceTypeUI.value;
        }
        else
        {
            Debug.LogError("Dice Type UI not recognized in DiceManager.cs!");
        }

        if (diceModeUI != null)
        {
            diceMode = (dice_modes)diceModeUI.value;
        }
        else
        {
            Debug.LogError("Dice Mode UI not recognized in DiceManager.cs!");
        }

        int parseResult = 0;

        if (int.TryParse(diceModifierUI.text, out parseResult))
        {
            diceModifier = parseResult;

            if (int.TryParse(diceNumUI.text, out parseResult))
            {
                diceNum = (uint)parseResult;
                RecalculateDicePositions();
                RecalculatePresentDice();
            }
            else
            {
                Debug.LogError("F****d Up Dice Number Parse!");
            }
        }
        else
        {
            Debug.LogError("F****d Up Dice Modifier Parse!");
        }
    }