An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace Fungus
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Command to execute and store the result of a Log
|
|
|
|
/// </summary>
|
|
|
|
[CommandInfo("Math",
|
|
|
|
"Log",
|
|
|
|
"Command to execute and store the result of a Log")]
|
|
|
|
[AddComponentMenu("")]
|
|
|
|
public class Log : BaseUnaryMathCommand
|
|
|
|
{
|
|
|
|
public enum Mode
|
|
|
|
{
|
|
|
|
Base10,
|
|
|
|
Natural
|
|
|
|
}
|
|
|
|
|
|
|
|
[Tooltip("Which log to use, natural or base 10")]
|
|
|
|
[SerializeField]
|
|
|
|
protected Mode mode = Mode.Natural;
|
|
|
|
|
|
|
|
public override void OnEnter()
|
|
|
|
{
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case Mode.Base10:
|
|
|
|
outValue.Value = Mathf.Log10(inValue.Value);
|
|
|
|
break;
|
|
|
|
case Mode.Natural:
|
|
|
|
outValue.Value = Mathf.Log(inValue.Value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Continue();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string GetSummary()
|
|
|
|
{
|
|
|
|
return mode.ToString() + " " + base.GetSummary();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|