From 5ce1137c9310b996515d3f57c635d7d269223c45 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 21 Oct 2014 10:41:22 +0100 Subject: [PATCH] Added MoveFrom, RotateFrom & ScaleFrom commands --- Assets/Fungus/iTween/Commands/MoveFrom.cs | 37 +++++++++++++++++++ .../Fungus/iTween/Commands/MoveFrom.cs.meta | 8 ++++ Assets/Fungus/iTween/Commands/RotateFrom.cs | 37 +++++++++++++++++++ .../Fungus/iTween/Commands/RotateFrom.cs.meta | 8 ++++ Assets/Fungus/iTween/Commands/ScaleFrom.cs | 35 ++++++++++++++++++ .../Fungus/iTween/Commands/ScaleFrom.cs.meta | 8 ++++ 6 files changed, 133 insertions(+) create mode 100644 Assets/Fungus/iTween/Commands/MoveFrom.cs create mode 100644 Assets/Fungus/iTween/Commands/MoveFrom.cs.meta create mode 100644 Assets/Fungus/iTween/Commands/RotateFrom.cs create mode 100644 Assets/Fungus/iTween/Commands/RotateFrom.cs.meta create mode 100644 Assets/Fungus/iTween/Commands/ScaleFrom.cs create mode 100644 Assets/Fungus/iTween/Commands/ScaleFrom.cs.meta diff --git a/Assets/Fungus/iTween/Commands/MoveFrom.cs b/Assets/Fungus/iTween/Commands/MoveFrom.cs new file mode 100644 index 00000000..f5641e4f --- /dev/null +++ b/Assets/Fungus/iTween/Commands/MoveFrom.cs @@ -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); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/iTween/Commands/MoveFrom.cs.meta b/Assets/Fungus/iTween/Commands/MoveFrom.cs.meta new file mode 100644 index 00000000..f25b0076 --- /dev/null +++ b/Assets/Fungus/iTween/Commands/MoveFrom.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d5ca001b90bd14834b7268b48a44c6de +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/iTween/Commands/RotateFrom.cs b/Assets/Fungus/iTween/Commands/RotateFrom.cs new file mode 100644 index 00000000..7d2aecd6 --- /dev/null +++ b/Assets/Fungus/iTween/Commands/RotateFrom.cs @@ -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); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/iTween/Commands/RotateFrom.cs.meta b/Assets/Fungus/iTween/Commands/RotateFrom.cs.meta new file mode 100644 index 00000000..ebed8b16 --- /dev/null +++ b/Assets/Fungus/iTween/Commands/RotateFrom.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cfc8560cbecd48adb3950b9dd7f2b82 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/iTween/Commands/ScaleFrom.cs b/Assets/Fungus/iTween/Commands/ScaleFrom.cs new file mode 100644 index 00000000..23ec8580 --- /dev/null +++ b/Assets/Fungus/iTween/Commands/ScaleFrom.cs @@ -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); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/iTween/Commands/ScaleFrom.cs.meta b/Assets/Fungus/iTween/Commands/ScaleFrom.cs.meta new file mode 100644 index 00000000..103b49bf --- /dev/null +++ b/Assets/Fungus/iTween/Commands/ScaleFrom.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d47cc719ae0d4d62a30b3cfa72b5785 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: