XOR#
Math / XOR
Can Read
Cannot Write
Description#
Returns True when value 1 and value 2 are different from each other
Parameters#
| Name | Description |
|---|---|
| Value 1 | The first value of the operation |
| Value 2 | The second value of the operation |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("XOR")]
[Category("Math/XOR")]
[Description("Returns True when value 1 and value 2 are different from each other")]
[Image(typeof(IconOR), ColorTheme.Type.Yellow, typeof(BadgeCross))]
[Parameter("Value 1", "The first value of the operation")]
[Parameter("Value 2", "The second value of the operation")]
[Keywords("Exclusive", "Either", "Different", "^", "Logic")]
[Serializable]
public class TypeBoolMathXOR : TypeBool
{
[SerializeField] private GetBool m_Value1 = new GetBool();
[SerializeField] private GetBool m_Value2 = new GetBool();
public override bool GetPreview(GameObject source)
{
return this.m_Value1.GetPreview(source) ^ this.m_Value2.GetPreview(source);
}
public override bool Get(Args args)
{
return this.m_Value1.Get(args) ^ this.m_Value2.Get(args);
}
public override string ToString()
{
return $"{this.m_Value1} XOR {this.m_Value2}";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}