/
TON618OFF
/
Unity-Project-RTU
Обзор
Документация
Войти
/
TON618OFF
/
Unity-Project-RTU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Library/PackageCache/com.unity.visualscripting@1.9.4/Runtime/VisualScripting.Flow/Framework/Math/Scalar/ScalarExponentiate.cs
49 строк
1 KB
TON618OFF
release
03 окт 2024, 22:20
03 окт 2024, 22:20
7c70e9f
Код
Авторство
О чём код?
using UnityEngine; namespace Unity.VisualScripting { /// <summary> /// Returns the power of a base and exponent. /// </summary> [UnitCategory("Math/Scalar")] [UnitTitle("Exponentiate")] [UnitOrder(105)] public sealed class ScalarExponentiate : Unit { /// <summary> /// The base. /// </summary> [DoNotSerialize] [PortLabel("x")] public ValueInput @base { get; private set; } /// <summary> /// The exponent. /// </summary> [DoNotSerialize] [PortLabel("n")] public ValueInput exponent { get; private set; } /// <summary> /// The power of base elevated to exponent. /// </summary> [DoNotSerialize] [PortLabel("x\u207f")] public ValueOutput power { get; private set; } protected override void Definition() { @base = ValueInput<float>(nameof(@base), 1); exponent = ValueInput<float>(nameof(exponent), 2); power = ValueOutput(nameof(power), Exponentiate); Requirement(@base, power); Requirement(exponent, power); } public float Exponentiate(Flow flow) { return Mathf.Pow(flow.GetValue<float>(@base), flow.GetValue<float>(exponent)); } } }