unidade bool para int

using System.Collections;
using UnityEngine;

public class SampleClass : MonoBehaviour
{
	//Example
	private int sampleInteger = 1;
    private bool sampleBoolean = false;
	private void SampleMethod(){
    	sampleInteger = BoolToInt(sampleBoolean);	//=> false becomes 0
        sampleBoolean = IntToBool(sampleInteger);	//=> 1 becomes true
    }

	//Methods for conversion between Integer and Boolean types
    private bool IntToBool(int val){
        if (val == 1)
            return true;
        return false;
    }
    private int BoolToInt(bool val){
        if (val)
            return 1;
        return 0;
    }
}
ALeonidou