chrisgregan
11 years ago
8 changed files with 199 additions and 0 deletions
@ -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); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: ee63e642958494f1ebed8116ae4b1103 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -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); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: fb1f6a369ef8c40bda77241018ab6bd6 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -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); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 76641c2c16481448eb6c0c1184fcdebe |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -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); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue