Browse Source

Added LookFrom, LookTo commands

master
chrisgregan 10 years ago
parent
commit
e822893c46
  1. 111
      Assets/Examples/iTween/iTween.unity
  2. 49
      Assets/Fungus/iTween/Commands/LookFrom.cs
  3. 8
      Assets/Fungus/iTween/Commands/LookFrom.cs.meta
  4. 49
      Assets/Fungus/iTween/Commands/LookTo.cs
  5. 8
      Assets/Fungus/iTween/Commands/LookTo.cs.meta
  6. 9
      Assets/Fungus/iTween/Commands/iTweenCommand.cs

111
Assets/Examples/iTween/iTween.unity

@ -291,7 +291,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
--- !u!1 &868138990
GameObject:
m_ObjectHideFlags: 0
@ -314,6 +314,8 @@ GameObject:
- 114: {fileID: 868139005}
- 114: {fileID: 868139004}
- 114: {fileID: 868139003}
- 114: {fileID: 868139007}
- 114: {fileID: 868139006}
m_Layer: 0
m_Name: FungusScript
m_TagString: Untagged
@ -359,7 +361,7 @@ MonoBehaviour:
x: 60
y: 60
width: 240
height: 274
height: 314
sequenceName: Test iTween
commandList:
- {fileID: 868138995}
@ -374,6 +376,8 @@ MonoBehaviour:
- {fileID: 868139005}
- {fileID: 868139004}
- {fileID: 868139003}
- {fileID: 868139007}
- {fileID: 868139006}
--- !u!114 &868138993
MonoBehaviour:
m_ObjectHideFlags: 0
@ -392,9 +396,10 @@ MonoBehaviour:
x: -350
y: -350
width: 1050
height: 1104
selectedSequence: {fileID: 0}
selectedCommands: []
height: 1124
selectedSequence: {fileID: 868138992}
selectedCommands:
- {fileID: 868139006}
variables: []
startSequence: {fileID: 868138992}
executeOnStart: 1
@ -647,6 +652,50 @@ MonoBehaviour:
fromTransform: {fileID: 0}
fromPosition: {x: 0, y: 1, z: 0}
isLocal: 0
--- !u!114 &868139006
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: 433657382cf894ff2973ee118eed40ea, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1621124268}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
fromTransform: {fileID: 1955612100}
fromPosition: {x: 0, y: 0, z: 0}
axis: 3
--- !u!114 &868139007
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: 3ec82c445301b4e9fb9b89cb2eb6a666, type: 3}
m_Name:
m_EditorClassIdentifier:
errorMessage:
indentLevel: 0
target: {fileID: 1090256565}
tweenName:
duration: 1
easeType: 2
loopType: 0
waitUntilFinished: 1
toTransform: {fileID: 1955612100}
toPosition: {x: 0, y: 0, z: 0}
axis: 3
--- !u!1 &1090256565
GameObject:
m_ObjectHideFlags: 0
@ -734,7 +783,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: e0d427add844a4d9faf970a3afa07583, type: 2}
propertyPath: m_RootOrder
value: 4
value: 5
objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: e0d427add844a4d9faf970a3afa07583, type: 2}
propertyPath: viewSize
@ -795,3 +844,53 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
--- !u!1 &1955612099
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1955612100}
- 212: {fileID: 1955612101}
m_Layer: 0
m_Name: Mushroom3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1955612100
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1955612099}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.119999997, y: 2.32999992, z: 0}
m_LocalScale: {x: .456456065, y: .456456065, z: .456456065}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
--- !u!212 &1955612101
SpriteRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1955612099}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_LightmapIndex: 255
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
m_Materials:
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_LightProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_SortingLayerID: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}

49
Assets/Fungus/iTween/Commands/LookFrom.cs

@ -0,0 +1,49 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Look From",
"Instantly rotates a GameObject to look at the supplied Vector3 then returns it to it's starting rotation over time.")]
public class LookFrom : iTweenCommand
{
public Transform fromTransform;
public Vector3 fromPosition;
public iTweenAxis axis;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (fromTransform == null)
{
tweenParams.Add("looktarget", fromPosition);
}
else
{
tweenParams.Add("looktarget", fromTransform);
}
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("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.LookFrom(target, tweenParams);
}
}
}

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

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

49
Assets/Fungus/iTween/Commands/LookTo.cs

@ -0,0 +1,49 @@
using UnityEngine;
using System.Collections;
namespace Fungus
{
[CommandInfo("iTween",
"Look To",
"Rotates a GameObject to look at a supplied Transform or Vector3 over time.")]
public class LookTo : iTweenCommand
{
public Transform toTransform;
public Vector3 toPosition;
public iTweenAxis axis;
public override void DoTween()
{
Hashtable tweenParams = new Hashtable();
tweenParams.Add("name", tweenName);
if (toTransform == null)
{
tweenParams.Add("looktarget", toPosition);
}
else
{
tweenParams.Add("looktarget", toTransform);
}
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("oncomplete", "OnComplete");
tweenParams.Add("oncompletetarget", gameObject);
tweenParams.Add("oncompleteparams", this);
iTween.LookTo(target, tweenParams);
}
}
}

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

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

9
Assets/Fungus/iTween/Commands/iTweenCommand.cs

@ -3,7 +3,14 @@ using System.Collections;
namespace Fungus
{
public enum iTweenAxis
{
None,
X,
Y,
Z
}
public abstract class iTweenCommand : Command
{
public GameObject target;

Loading…
Cancel
Save