public GameDiceGroup(Action <int> onRollComplete, params GameDice[] dice) { m_OnRollComplete = onRollComplete; this.dice = dice; for (int i = 0; i < dice.Length; i++) { GameDice d = dice[i]; d.ListenToRoll(OnDiceRolled); m_Offsets.Add(d, VectorUtils.GetRandomVector3(-dice.Length, dice.Length).normalized *(dice.Length * 0.05f)); m_RotationSpeeds.Add(d, VectorUtils.GetRandomVector3(-0.5f, 0.5f)); } }
private void AddImpulse(GameDice d, Vector3 power, Vector3 torque) { d.Body.AddForce(power, ForceMode.VelocityChange); d.Body.AddTorque(torque); }