Ceil#
Math / Ceil
Can Read
Cannot Write
Description#
Moves every component of a vector up to the next whole value
Parameters#
| Name | Description |
|---|---|
| Vector | The vector whose components are converted |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Ceil")]
[Category("Math/Ceil")]
[Description("Moves every component of a vector up to the next whole value")]
[Image(typeof(IconVector2), ColorTheme.Type.Yellow, typeof(BadgeCeil))]
[Parameter("Vector", "The vector whose components are converted")]
[Keywords("Vector", "Integer", "Convert", "Whole", "Decimal", "Snap", "Upper")]
[Serializable]
public class TypeVector2MathCeil : TypeVector2
{
[SerializeField] private GetVector2 m_Vector = new GetVector2();
public override Vector2 GetPreview(GameObject source) => Convert(this.m_Vector.GetPreview(source));
public override Vector2 Get(Args args) => Convert(this.m_Vector.Get(args));
private static Vector2 Convert(Vector2 vector)
{
return new Vector2(Mathf.Ceil(vector.x), Mathf.Ceil(vector.y));
}
public override string ToString()
{
return $"Ceil({this.m_Vector})";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}