I'm really new to coding and I want a 50% chance of raising an int value by 1.
Here's what I'm working with:
public class IfExperiment : MonoBehaviour
{
[Range(0,100)] public int force = 0;
// Start is called before the first frame update
void Start()
{
force += 2;
}
// Update is called once per frame
void Update()
{
Rigidbody rb= GetComponent<Rigidbody>();
rb.AddForce(Vector3.one * force);
if (force > 1)
{
rb.AddForce(Vector3.forward * force);
}
}
}
it's going to speed up the force depending on 'force' int I declared, so I want a chance of raising the value to speed it up.
I tried a lot of different idea on what could be the solution, but I'm just starting to learn C# so I need some help.