I’m relatively new to C#, but not an entire newblet. What I’m trying to create is a simple die rolling class (in the d20 style) with a separate function for each die, that can be called from other scripts (to save doing the math/Random code each time I need to roll one of the die). That also stores the result in a variable, (So it can be checked if the same result is needed again) but can also be re-rolled when required. I’ve tried it a few separate ways, but no matter how, every time I attempt to call them from other scripts, I get numerous and incessant compile errors. I’m certain I’m missing just one simple thing, and I’ll probably boot myself up the rear when I realize what I’ve forgotten to add! Anyway, here is what I have tried so far;
using UnityEngine;
using System.Collections;
public class DieRoller : MonoBehaviour {
public static DieRoller instance2;
public int d4 = 0;
public int d6 = 0;
public int d8 = 0;
public int d10 = 0;
public int d12 = 0;
public int d20 = 0;
public int d100 = 0;
public bool rolld20 = false;
void Awake ()
{
instance2 = this;
}
void Start () {
}
void Update () {
}
public void rolld4()
{
d4 = Random.Range (1,4);
}
public void rolld6()
{
d6 = Random.Range(1,6);
}
public void rolld8()
{
d8 = Random.Range(1,8);
}
public void rolld10()
{
d10 = Random.Range (1,10);
}
public void rolld12()
{
d12 = Random.Range(1,12);
}
public int rollDie(bool rolld20)
{
if (rolld20 == true)
{
d20 = Random.Range(1,12);
}
}
public void rolld100()
{
d100 = Random.Range(1,100);
}
}
The various methods I’ve attempted of calling the functions are also meeting the same fate. What have I missed? Please, oh wise Unity gurus, save me from the constant head-desking over such an easy problem, before I give myself a concussion! ![]()
That class looks fine, how are you calling the functions? Could you show that script?
– GameVortexWhat direction do you need? The library comes with documentation and examples already: // Extracting features from two fingerprint images var featExtractor = new MTripletsExtractor(){ MtiaExtractor = new Ratha1995MinutiaeExtractor()}; var features1 = featExtractor.ExtractFeatures(fingerprintImg1); var features2 = featExtractor.ExtractFeatures(fingerprintImg2); // Match features var matcher = new M3gl(); double similarity = matcher.Match(features1, features2); if similarity exceeds a given threshold, the fingerprints match.
– tanoshimi