示例#1
0
    public void SpawnDice(int diceToSpawn)
    {
        for (int i = 0; i < diceToSpawn; ++i)
        {
            PhysicsDie currentDie = m_PhysicsDice[i];

            currentDie.gameObject.SetActive(true);

            // Spawn dice in random area in the spawn point.
            currentDie.transform.position = new Vector3
                                            (
                Random.Range(-m_SpawnPointExtentsX, m_SpawnPointExtentsX),
                0,
                Random.Range(-m_SpawnPointExtentsZ, m_SpawnPointExtentsZ)
                                            ) + m_DiceSpawnPoint.position;

            currentDie.RollDie();
        }
    }
示例#2
0
    public void ApplyCardEffects()
    {
        if (!canEndDay)
        {
            return;
        }

        JamesManager.instance.IncrementDaysSurvived();
        m_AudioSource.PlayOneShot(endDay);
        for (int i = 0; i < m_CardsInPlay.Length; ++i)
        {
            JamesCard card = m_CardsInPlay[i];
            card.isUnflipped = false;
            card.CheckResult();
            card.GetAnimator().SetBool("Flipped", true);
            PhysicsDie cardDie = card.GetDie();
            if (cardDie != null)
            {
                cardDie.gameObject.SetActive(false);
            }
        }
    }
    public void RollDice()
    {
        // Reset all dice
        foreach (PhysicsDie die in dice)
        {
            die.SetModifier(0);
            die.gameObject.SetActive(false);
            die.GetRenderer().material.color = Color.white;
        }

        // Apply modifiers - modifiers can stack!
        while (m_DiceScoreModifiers.Count > 0)
        {
            PhysicsDie dieToAffect = dice[Random.Range(0, diceToRoll + diceToRollModifier)];
            dieToAffect.AddModifier(m_DiceScoreModifiers.Dequeue());
            dieToAffect.GetRenderer().material.color = Colorx.Slerp(Color.white, dieToAffect.m_Modifier < 0 ? new Color(0.28f, 0.69f, 0.96f) : new Color(0.93f, 0.74f, 0.2f), Mathf.Clamp(Mathf.Abs(dieToAffect.m_Modifier) / (float)5, 0, 1));
        }

        DiceManager.instance.SpawnDice(diceToRoll + diceToRollModifier);

        diceToRollModifier = 0;
    }
示例#4
0
 public void SetDie(PhysicsDie die)
 {
     dieOnCard = die;
     Debug.Log("Die set!");
 }
示例#5
0
 private void Awake()
 {
     m_PhysicsDie = GetComponent <PhysicsDie>();
 }