chrisgregan
9 years ago
8 changed files with 243 additions and 36 deletions
@ -0,0 +1,51 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[VariableInfo("Other", "Animator")] |
||||
[AddComponentMenu("")] |
||||
public class AnimatorVariable : VariableBase<Animator> |
||||
{} |
||||
|
||||
[System.Serializable] |
||||
public struct AnimatorData |
||||
{ |
||||
[SerializeField] |
||||
[VariableProperty("<Value>", typeof(AnimatorVariable))] |
||||
public AnimatorVariable animatorRef; |
||||
|
||||
[SerializeField] |
||||
public Animator animatorVal; |
||||
|
||||
public AnimatorData(Animator v) |
||||
{ |
||||
animatorVal = v; |
||||
animatorRef = null; |
||||
} |
||||
|
||||
public static implicit operator Animator(AnimatorData animatorData) |
||||
{ |
||||
return animatorData.Value; |
||||
} |
||||
|
||||
public Animator Value |
||||
{ |
||||
get { return (animatorRef == null) ? animatorVal : animatorRef.value; } |
||||
set { if (animatorRef == null) { animatorVal = value; } else { animatorRef.value = value; } } |
||||
} |
||||
|
||||
public string GetDescription() |
||||
{ |
||||
if (animatorRef == null) |
||||
{ |
||||
return animatorVal.ToString(); |
||||
} |
||||
else |
||||
{ |
||||
return animatorRef.key; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 8cbd0c93fbe0e46f78685c33d82bcc7b |
||||
timeCreated: 1457886300 |
||||
licenseType: Free |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
Loading…
Reference in new issue