Browse Source

Added animator parameter commands

master
chrisgregan 11 years ago
parent
commit
70c8bfc678
  1. 42
      Assets/Fungus/Sprite/Commands/SetAnimBool.cs
  2. 8
      Assets/Fungus/Sprite/Commands/SetAnimBool.cs.meta
  3. 42
      Assets/Fungus/Sprite/Commands/SetAnimFloat.cs
  4. 8
      Assets/Fungus/Sprite/Commands/SetAnimFloat.cs.meta
  5. 42
      Assets/Fungus/Sprite/Commands/SetAnimInteger.cs
  6. 8
      Assets/Fungus/Sprite/Commands/SetAnimInteger.cs.meta
  7. 41
      Assets/Fungus/Sprite/Commands/SetAnimTrigger.cs
  8. 8
      Assets/Fungus/Sprite/Commands/SetAnimTrigger.cs.meta

42
Assets/Fungus/Sprite/Commands/SetAnimBool.cs

@ -0,0 +1,42 @@
using UnityEngine;
using System;
using System.Collections;
namespace Fungus.Script
{
[CommandInfo("Animation",
"Set Anim Bool",
"Sets a boolean parameter on an animator to control an animation")]
public class SetAnimBool : FungusCommand
{
public Animator animator;
public string parameterName;
public BooleanData value;
public override void OnEnter()
{
if (animator != null)
{
animator.SetBool(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);
}
}
}

8
Assets/Fungus/Sprite/Commands/SetAnimBool.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee63e642958494f1ebed8116ae4b1103
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

42
Assets/Fungus/Sprite/Commands/SetAnimFloat.cs

@ -0,0 +1,42 @@
using UnityEngine;
using System;
using System.Collections;
namespace Fungus.Script
{
[CommandInfo("Animation",
"Set Anim Float",
"Sets a float parameter on an animator to control an animation")]
public class SetAnimFloat : FungusCommand
{
public Animator animator;
public string parameterName;
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);
}
}
}

8
Assets/Fungus/Sprite/Commands/SetAnimFloat.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fb1f6a369ef8c40bda77241018ab6bd6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

42
Assets/Fungus/Sprite/Commands/SetAnimInteger.cs

@ -0,0 +1,42 @@
using UnityEngine;
using System;
using System.Collections;
namespace Fungus.Script
{
[CommandInfo("Animation",
"Set Anim Integer",
"Sets an integer parameter on an animator to control an animation")]
public class SetAnimInteger : FungusCommand
{
public Animator animator;
public string parameterName;
public IntegerData value;
public override void OnEnter()
{
if (animator != null)
{
animator.SetInteger(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);
}
}
}

8
Assets/Fungus/Sprite/Commands/SetAnimInteger.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 76641c2c16481448eb6c0c1184fcdebe
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

41
Assets/Fungus/Sprite/Commands/SetAnimTrigger.cs

@ -0,0 +1,41 @@
using UnityEngine;
using System;
using System.Collections;
namespace Fungus.Script
{
[CommandInfo("Animation",
"Set Anim Trigger",
"Sets a trigger parameter on an animator to control an animation")]
public class SetAnimTrigger : FungusCommand
{
public Animator animator;
public string parameterName;
public override void OnEnter()
{
if (animator != null)
{
animator.SetTrigger(parameterName);
}
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);
}
}
}

8
Assets/Fungus/Sprite/Commands/SetAnimTrigger.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0729d4f369e6a4241a6e7e3b8b9c1933
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save