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.
47 lines
991 B
47 lines
991 B
10 years ago
|
using UnityEngine;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
|
||
10 years ago
|
namespace Fungus
|
||
10 years ago
|
{
|
||
|
[CommandInfo("Animation",
|
||
|
"Set Anim Float",
|
||
10 years ago
|
"Sets a float parameter on an Animator component to control a Unity animation")]
|
||
10 years ago
|
public class SetAnimFloat : Command
|
||
10 years ago
|
{
|
||
10 years ago
|
[Tooltip("Reference to an Animator component in a game object")]
|
||
10 years ago
|
public Animator animator;
|
||
10 years ago
|
|
||
|
[Tooltip("Name of the float Animator parameter that will have its value changed")]
|
||
10 years ago
|
public string parameterName;
|
||
10 years ago
|
|
||
|
[Tooltip("The float value to set the parameter to")]
|
||
10 years ago
|
public FloatData value;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
if (animator != null)
|
||
|
{
|
||
|
animator.SetFloat(parameterName, value.Value);
|
||
|
}
|
||
|
|
||
|
Continue();
|
||
|
}
|
||
|
|
||
|
public override string GetSummary()
|
||
|
{
|
||
|
if (animator == null)
|
||
|
{
|
||
|
return "Error: No animator selected";
|
||
|
}
|
||
|
|
||
|
return animator.name + " (" + parameterName + ")";
|
||
|
}
|
||
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(170, 204, 169, 255);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|