AND#
Math / AND
Can Read
Cannot Write
Description#
Returns True if both value 1 and value 2 are True
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("AND")]
[Category("Math/AND")]
[Description("Returns True if both value 1 and value 2 are True")]
[Image(typeof(IconAND), ColorTheme.Type.Yellow)]
[Keywords("All", "&&", "Multiply")]
[Serializable]
public class TypeBoolMathAND : 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} AND {this.m_Value2}";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}