Bool#
Bool / Bool
Can Read
Cannot Write
Description#
Returns one when the boolean value is True and zero when it is False
Parameters#
| Name | Description |
|---|---|
| Bool | The boolean value converted to a number |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Bool")]
[Category("Bool/Bool")]
[Description("Returns one when the boolean value is True and zero when it is False")]
[Image(typeof(IconToggleOn), ColorTheme.Type.Blue)]
[Parameter("Bool", "The boolean value converted to a number")]
[Keywords("Boolean", "True", "False", "One", "Zero", "Convert", "Cast")]
[Serializable]
public class TypeNumberBoolGet : TypeNumber
{
[SerializeField] private GetBool m_Bool = new GetBool();
public override double GetPreview(GameObject source) => this.m_Bool.GetPreview(source) ? 1f : 0f;
public override double Get(Args args)
{
return this.m_Bool.Get(args) ? 1f : 0f;
}
public override string ToString()
{
return this.m_Bool.ToString();
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}