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.
40 lines
917 B
40 lines
917 B
7 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
|
// <summary>
|
||
|
/// Normalise a vector3, output can be the same as the input
|
||
|
/// </summary>
|
||
|
[CommandInfo("Vector3",
|
||
|
"Normalise",
|
||
|
"Normalise a Vector3")]
|
||
|
[AddComponentMenu("")]
|
||
|
public class Vector3Normalise : Command
|
||
|
{
|
||
|
[SerializeField]
|
||
|
protected Vector3Data vec3In, vec3Out;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
vec3Out.Value = vec3In.Value.normalized;
|
||
|
|
||
|
Continue();
|
||
|
}
|
||
|
|
||
|
public override string GetSummary()
|
||
|
{
|
||
|
if (vec3Out.vector3Ref == null)
|
||
|
return "";
|
||
|
else
|
||
|
return vec3Out.vector3Ref.Key;
|
||
|
}
|
||
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(235, 191, 217, 255);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|