chrisgregan
9 years ago
22 changed files with 591 additions and 90 deletions
@ -0,0 +1,51 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[VariableInfo("Other", "Transform")] |
||||
[AddComponentMenu("")] |
||||
public class TransformVariable : VariableBase<Transform> |
||||
{} |
||||
|
||||
[System.Serializable] |
||||
public struct TransformData |
||||
{ |
||||
[SerializeField] |
||||
[VariableProperty("<Value>", typeof(TransformVariable))] |
||||
public TransformVariable transformRef; |
||||
|
||||
[SerializeField] |
||||
public Transform transformVal; |
||||
|
||||
public TransformData(Transform v) |
||||
{ |
||||
transformVal = v; |
||||
transformRef = null; |
||||
} |
||||
|
||||
public static implicit operator Transform(TransformData vector3Data) |
||||
{ |
||||
return vector3Data.Value; |
||||
} |
||||
|
||||
public Transform Value |
||||
{ |
||||
get { return (transformRef == null) ? transformVal : transformRef.value; } |
||||
set { if (transformRef == null) { transformVal = value; } else { transformRef.value = value; } } |
||||
} |
||||
|
||||
public string GetDescription() |
||||
{ |
||||
if (transformRef == null) |
||||
{ |
||||
return transformVal.ToString(); |
||||
} |
||||
else |
||||
{ |
||||
return transformRef.key; |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 633bea14077b44e19956e8113fbac7a4 |
||||
timeCreated: 1457893486 |
||||
licenseType: Free |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
Loading…
Reference in new issue