Increment Number#
Math / Arithmetic / Increment Number
Description#
Increases a numeric value by a given amount
Parameters#
| Name | Description |
|---|---|
| Set | The value that is incremented |
| Value | The amount to increment |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Increment Number")]
[Image(typeof(IconPlusCircle), ColorTheme.Type.Teal)]
[Description("Increases a numeric value by a given amount")]
[Category("Math/Arithmetic/Increment Number")]
[Parameter("Set", "The value that is incremented")]
[Parameter("Value", "The amount to increment")]
[Keywords("Set", "Change", "Modify", "+", "Plus", "Sum", "Add", "Increase")]
[Keywords("Int", "Integer", "Float", "Value", "Decimal")]
[Serializable]
public class InstructionCoreMathNumberIncrement : Instruction
{
[SerializeField] private SetNumber m_Set = new SetNumber();
[SerializeField] private GetNumber m_Value = new GetNumber();
protected override string GetTitle(GameObject source) => $"{this.m_Set} + {this.m_Value}";
protected override Awaitable Run(Args args)
{
double current = this.m_Set.Get(args);
double value = this.m_Value.Get(args);
this.m_Set.Set(current + value, args);
return Done;
}
}
}