chrisgregan
10 years ago
6 changed files with 133 additions and 0 deletions
@ -0,0 +1,37 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[CommandInfo("iTween", |
||||
"Move From", |
||||
"Moves a game object from a specified position back to its starting position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")] |
||||
public class MoveFrom : iTweenCommand |
||||
{ |
||||
public Transform fromTransform; |
||||
public Vector3 fromPosition; |
||||
public bool isLocal; |
||||
|
||||
public override void DoTween() |
||||
{ |
||||
Hashtable tweenParams = new Hashtable(); |
||||
if (fromTransform == null) |
||||
{ |
||||
tweenParams.Add("position", fromPosition); |
||||
} |
||||
else |
||||
{ |
||||
tweenParams.Add("position", fromTransform); |
||||
} |
||||
tweenParams.Add("time", duration); |
||||
tweenParams.Add("easetype", easeType); |
||||
tweenParams.Add("looptype", loopType); |
||||
tweenParams.Add("isLocal", isLocal); |
||||
tweenParams.Add("oncomplete", "OnComplete"); |
||||
tweenParams.Add("oncompletetarget", gameObject); |
||||
tweenParams.Add("oncompleteparams", this); |
||||
iTween.MoveFrom(target, tweenParams); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: d5ca001b90bd14834b7268b48a44c6de |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,37 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[CommandInfo("iTween", |
||||
"Rotate From", |
||||
"Rotates a game object from the specified angles back to its starting orientation over time.")] |
||||
public class RotateFrom : iTweenCommand |
||||
{ |
||||
public Transform fromTransform; |
||||
public Vector3 fromRotation; |
||||
public bool isLocal; |
||||
|
||||
public override void DoTween() |
||||
{ |
||||
Hashtable tweenParams = new Hashtable(); |
||||
if (fromTransform == null) |
||||
{ |
||||
tweenParams.Add("rotation", fromRotation); |
||||
} |
||||
else |
||||
{ |
||||
tweenParams.Add("rotation", fromTransform); |
||||
} |
||||
tweenParams.Add("time", duration); |
||||
tweenParams.Add("easetype", easeType); |
||||
tweenParams.Add("looptype", loopType); |
||||
tweenParams.Add("isLocal", isLocal); |
||||
tweenParams.Add("oncomplete", "OnComplete"); |
||||
tweenParams.Add("oncompletetarget", gameObject); |
||||
tweenParams.Add("oncompleteparams", this); |
||||
iTween.RotateFrom(target, tweenParams); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 6cfc8560cbecd48adb3950b9dd7f2b82 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,35 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[CommandInfo("iTween", |
||||
"Scale From", |
||||
"Changes a game object's scale to the specified value and back to its original scale over time.")] |
||||
public class ScaleFrom : iTweenCommand |
||||
{ |
||||
public Transform fromTransform; |
||||
public Vector3 fromScale; |
||||
|
||||
public override void DoTween() |
||||
{ |
||||
Hashtable tweenParams = new Hashtable(); |
||||
if (fromTransform == null) |
||||
{ |
||||
tweenParams.Add("scale", fromScale); |
||||
} |
||||
else |
||||
{ |
||||
tweenParams.Add("scale", fromTransform); |
||||
} |
||||
tweenParams.Add("time", duration); |
||||
tweenParams.Add("easetype", easeType); |
||||
tweenParams.Add("looptype", loopType); |
||||
tweenParams.Add("oncomplete", "OnComplete"); |
||||
tweenParams.Add("oncompletetarget", gameObject); |
||||
tweenParams.Add("oncompleteparams", this); |
||||
iTween.ScaleFrom(target, tweenParams); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue