OR#
Math / OR
Can Read
Cannot Write
Description#
Returns True if value 1 or value 2 is True
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("OR")]
[Category("Math/OR")]
[Description("Returns True if value 1 or value 2 is True")]
[Image(typeof(IconOR), ColorTheme.Type.Yellow)]
[Keywords("Any", "||", "Add", "Sum")]
[Serializable]
public class TypeBoolMathOR : TypeBool
{
[SerializeField] private GetBool m_Value1 = new GetBool();
[SerializeField] private GetBool m_Value2 = new GetBool();
public override bool GetPreview(GameObject source)
{
bool value1 = this.m_Value1.GetPreview(source);
bool value2 = this.m_Value1.GetPreview(source);
return value1 || value2;
}
public override bool Get(Args args)
{
bool value1 = this.m_Value1.Get(args);
bool value2 = this.m_Value2.Get(args);
return value1 || value2;
}
public override string ToString()
{
return $"{this.m_Value1} OR {this.m_Value2}";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}