Hello, im trying to make simple card game for learn myself.
and i have question on random persentage system.
I have 100 prefab of normal card.
I have 1 prefab of special card.
every signed time get whatever card to put on my cardSet list.
When the player make mouse button click the card appear in windows
I want to in special variables(like when my happyness are less than 20) the Special card sould be appear with Weighted average in my cardSet list
how i make that?
here are my scripts.
public List<GameObject> cardSet = new List<GameObject>();
void Update()
{
timeCount += Time.deltaTime;
if(timeCount >= cardTime && cardSet.Count <= maxCardSave)
{
SpawnCard();
timeCount = 0;
}
if (Input.GetMouseButtonUp(0))
{
cardSet[0].transform.SetParent(canvas2.transform,false);
cardSet[0].transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.InBounce);
}
}
void SpawnCard()
{
int randomCard = Random.Range(0, 3);
cardSet.Add(Instantiate(totalCard[randomCard])as GameObject);
}