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.

54 lines
1.2 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Fungus
{
// <summary>
/// Convert fungus vec3 to vec2
/// </summary>
[CommandInfo("Vector3",
"ToVector2",
"Convert Fungus Vector3 to Fungus Vector2")]
[AddComponentMenu("")]
public class Vector3ToVector2 : Command
{
[SerializeField]
protected Vector3Data vec3;
[SerializeField]
protected Vector2Data vec2;
public override void OnEnter()
{
vec2.Value = vec3.Value;
Continue();
}
public override string GetSummary()
{
if (vec3.vector3Ref != null && vec2.vector2Ref != null)
{
return "Converting " + vec3.vector3Ref.Key + " to " + vec2.vector2Ref.Key;
}
return "Error: variables not set";
}
public override Color GetButtonColor()
{
return new Color32(235, 191, 217, 255);
}
public override bool HasReference(Variable variable)
{
if (variable == vec3.vector3Ref || variable == vec2.vector2Ref)
return true;
return false;
}
}
}