UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionNeed help with perncentage EmptyNeed help with perncentage

more_horiz
Hello,

I've been trying a long time to program a code which gives probabilities my Wheel of Fortune. The wheel of fortune has six fields, and each field is to get a chance in percent.

I have so far:

Number between 1-10 = 10% probability
Number between 11-40 = 30% probability
Number between 41-100 = 60% probability

[Random.Range(int min,int max)]

But i dont know how to use it.... Can someone help me?

Thanks.Kevin.

descriptionNeed help with perncentage EmptyRe: Need help with perncentage

more_horiz
Hello this is a small example

Code:

using UnityEngine;
using System.Collections;

public class Random : MonoBehaviour {

 public  int R1Min =1;
 public  int R1Max = 100;
 private int number;


    void OnGUI()
    {
        if (Input.GetKeyDown(KeyCode.G))
        {
            
            number = Random.Range(R1Min, R1Max);
            Debug.Log(number);
        }

        GUI.Label(new Rect(10, 10, 220, 220), "The number that was generated: " + number);
    }
}

descriptionNeed help with perncentage EmptyRe: Need help with perncentage

more_horiz
Thank you very much Smile, but is that working for the field of the wheel of fortune how i decribed it?

descriptionNeed help with perncentage EmptyRe: Need help with perncentage

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply