Browse Source

Added ShakePosition, ShakeRotation & ShakeScale commands

master
chrisgregan 10 years ago
parent
commit
d3b40a0010
  1. 145
      Assets/Examples/iTween/iTween.unity
  2. 43
      Assets/Fungus/iTween/Commands/ShakePosition.cs
  3. 8
      Assets/Fungus/iTween/Commands/ShakePosition.cs.meta
  4. 30
      Assets/Fungus/iTween/Commands/ShakeRotation.cs
  5. 8
      Assets/Fungus/iTween/Commands/ShakeRotation.cs.meta
  6. 28
      Assets/Fungus/iTween/Commands/ShakeScale.cs
  7. 8
      Assets/Fungus/iTween/Commands/ShakeScale.cs.meta

145
Assets/Examples/iTween/iTween.unity

@ -316,6 +316,12 @@ GameObject:
- 114: {fileID: 868139003}
- 114: {fileID: 868139007}
- 114: {fileID: 868139006}
- 114: {fileID: 868139008}
- 114: {fileID: 868139009}
- 114: {fileID: 868139010}
- 114: {fileID: 868139011}
- 114: {fileID: 868139012}
- 114: {fileID: 868139013}
m_Layer: 0
m_Name: FungusScript
m_TagString: Untagged
@ -361,10 +367,16 @@ MonoBehaviour:
x: 60
y: 60
width: 240
height: 314
height: 434
sequenceName: Test iTween
commandList:
- {fileID: 868138995}
- {fileID: 868139011}
- {fileID: 868139012}
- {fileID: 868139013}
- {fileID: 868139008}
- {fileID: 868139009}
- {fileID: 868139010}
- {fileID: 868138991}
- {fileID: 868138996}
- {fileID: 868138998}
@ -389,17 +401,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3}
m_Name:
m_EditorClassIdentifier:
scrollPos: {x: 3, y: 0}
scrollPos: {x: 171, y: -80}
zoom: 1
scrollViewRect:
serializedVersion: 2
x: -350
y: -350
width: 1050
height: 1124
height: 1244
selectedSequence: {fileID: 868138992}
selectedCommands:
- {fileID: 868139006}
- {fileID: 868139013}
variables: []
startSequence: {fileID: 868138992}
executeOnStart: 1
@ -696,6 +708,131 @@ MonoBehaviour:
toTransform: {fileID: 1955612100}
toPosition: {x: 0, y: 0, z: 0}
axis: 3
--- !u!114 &868139008
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 868138990}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 358f65040c3ef4327b70b2813cc197c7, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
amount: {x: 1, y: 1, z: 0}
isLocal: 0
axis: 0
--- !u!114 &868139009
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 868138990}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 82c753a90aa184bd88472f4589167f0b, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 131346341}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
amount: {x: 0, y: 0, z: 45}
space: 1
--- !u!114 &868139010
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 868138990}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e61780d2ea956492a8f59308dae6f12c, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
amount: {x: .5, y: .5, z: 0}
--- !u!114 &868139011
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 868138990}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 720f059c883c4402c89fcc507d5f7e0d, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
amount: {x: 0, y: 1, z: 0}
space: 1
--- !u!114 &868139012
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 868138990}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea1bc1400ac79424ba3c1aca77fb5d42, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
amount: {x: 0, y: 0, z: 45}
space: 1
--- !u!114 &868139013
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 868138990}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea4591c01defd496586e9b7237c966c5, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1955612099}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
amount: {x: 1, y: 1, z: 0}
--- !u!1 &1090256565
GameObject:
m_ObjectHideFlags: 0

43
Assets/Fungus/iTween/Commands/ShakePosition.cs

@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Shake Position",
"Randomly shakes a GameObject's position by a diminishing amount over time.")]
public class ShakePosition : iTweenCommand
{
public Vector3 amount;
public bool isLocal;
public iTweenAxis axis;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
switch (axis)
{
case iTweenAxis.X:
tweenParams.Add("axis", "x");
break;
case iTweenAxis.Y:
tweenParams.Add("axis", "y");
break;
case iTweenAxis.Z:
tweenParams.Add("axis", "z");
break;
}
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.ShakePosition(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/Commands/ShakePosition.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 358f65040c3ef4327b70b2813cc197c7
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

30
Assets/Fungus/iTween/Commands/ShakeRotation.cs

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Shake Rotation",
"Randomly shakes a GameObject's rotation by a diminishing amount over time.")]
public class ShakeRotation : iTweenCommand
{
public Vector3 amount;
public Space space = Space.Self;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
tweenParams.Add("space", space);
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.ShakeRotation(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/Commands/ShakeRotation.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 82c753a90aa184bd88472f4589167f0b
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

28
Assets/Fungus/iTween/Commands/ShakeScale.cs

@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Shake Scale",
"Randomly shakes a GameObject's rotation by a diminishing amount over time.")]
public class ShakeScale : iTweenCommand
{
public Vector3 amount;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
tweenParams.Add("amount", amount);
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.ShakeScale(target, tweenParams);
}
}
}

8
Assets/Fungus/iTween/Commands/ShakeScale.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e61780d2ea956492a8f59308dae6f12c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save