Max#
Math / Max
Can Read
Cannot Write
Description#
Returns a vector that is made from the largest components of two vectors
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Max")]
[Category("Math/Max")]
[Description("Returns a vector that is made from the largest components of two vectors")]
[Image(typeof(IconGreaterThan), ColorTheme.Type.Yellow)]
[Keywords("Vector")]
[Serializable]
public class TypeVector2MathMax : TypeVector2
{
[SerializeField] private GetVector2 m_VectorA = new GetVector2();
[SerializeField] private GetVector2 m_VectorB = new GetVector2();
public override Vector2 GetPreview(GameObject source) =>
Vector2.Max(this.m_VectorA.GetPreview(source), this.m_VectorB.GetPreview(source));
public override Vector2 Get(Args args)
{
return Vector2.Max(
this.m_VectorA.Get(args),
this.m_VectorB.Get(args)
);
}
public override string ToString()
{
return $"Max ({this.m_VectorA}, {this.m_VectorB})";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}