Commit d96d600b authored by 潘梓豪's avatar 潘梓豪

Initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Aa]ssetBundles/
/ABCache/
/HotFix_Project/obj/
/Assets/AssetStoreTools*
# Visual Studio 2015 cache directory
/.vs/
/HotFix_Project/.vs/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
# Unity3D generated meta files
*.pidb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
*.unitypackage.meta
*.DS_Store
.DS_Store
# office相关临时文件
~$*.pptx
~$*.docx
~$*.ppt
~$*.doc
~$*.xlsx
~$*.xls
~$*.pptx.meta
~$*.docx.meta
~$*.ppt.meta
~$*.doc.meta
~$*.xlsx.meta
~$*.xls.meta
# cad相关临时文件
*.dwg.bak
*.dwg.lck
\ No newline at end of file
[submodule "Assets/ZeusLibs/ZeusUFPS"]
path = Assets/ZeusLibs/ZeusUFPS
url = git@gitlab.sd-zeus.com:zeuslib/ZeusUFPS.git
[submodule "Assets/ZeusLibs/ZeusUtility"]
path = Assets/ZeusLibs/ZeusUtility
url = git@gitlab.sd-zeus.com:zeuslib/ZeusUtility.git
[submodule "Assets/ZeusLibs/zeus_animation"]
path = Assets/ZeusLibs/zeus_animation
url = git@gitlab.sd-zeus.com:zeuslib/zeus_animation.git
[submodule "Assets/ZeusLibs/ZeusAccess"]
path = Assets/ZeusLibs/ZeusAccess
url = git@gitlab.sd-zeus.com:zeuslib/ZeusAccess.git
[submodule "Assets/ZeusLibs/DTComponent"]
path = Assets/ZeusLibs/DTComponent
url = git@gitlab.sd-zeus.com:zeuslib/DTComponent.git
[submodule "Assets/ZeusLibs/ZeusSQLite"]
path = Assets/ZeusLibs/ZeusSQLite
url = git@gitlab.sd-zeus.com:zeuslib/ZeusSQLite.git
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
This diff is collapsed.
fileFormatVersion: 2
guid: f8b0fd27500657148ae7dfd917836189
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 3187742b458d5aa4ba173a695862769a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 31c511352d68dea48b960ff7ce470b95
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7b73f4b990421bf449d06866df8fa57f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e0f28db390b02c649923758f704fd26e
folderAsset: yes
timeCreated: 1517993733
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 6fa3fbb2e52978b4aaf7ba4568017953
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
fileFormatVersion: 2
guid: cc328fb751af0094c9ac73b453987f70
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using System;
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Color Variable using an Animation Curve.")]
public class AnimateColor : AnimateFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmColor colorVariable;
[RequiredField]
public FsmAnimationCurve curveR;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to colorVariable.r.")]
public Calculation calculationR;
[RequiredField]
public FsmAnimationCurve curveG;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to colorVariable.g.")]
public Calculation calculationG;
[RequiredField]
public FsmAnimationCurve curveB;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to colorVariable.b.")]
public Calculation calculationB;
[RequiredField]
public FsmAnimationCurve curveA;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to colorVariable.a.")]
public Calculation calculationA;
private bool finishInNextStep;
public override void Reset()
{
base.Reset();
colorVariable = new FsmColor{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[4];
fromFloats = new float[4];
fromFloats[0] = colorVariable.IsNone ? 0f : colorVariable.Value.r;
fromFloats[1] = colorVariable.IsNone ? 0f : colorVariable.Value.g;
fromFloats[2] = colorVariable.IsNone ? 0f : colorVariable.Value.b;
fromFloats[3] = colorVariable.IsNone ? 0f : colorVariable.Value.a;
curves = new AnimationCurve[4];
curves[0] = curveR.curve;
curves[1] = curveG.curve;
curves[2] = curveB.curve;
curves[3] = curveA.curve;
calculations = new Calculation[4];
calculations[0] = calculationR;
calculations[1] = calculationG;
calculations[2] = calculationB;
calculations[3] = calculationA;
Init();
// Set initial value
if (Math.Abs(delay.Value) < 0.01f)
{
UpdateVariableValue();
}
}
private void UpdateVariableValue()
{
if (!colorVariable.IsNone)
{
colorVariable.Value = new Color(resultFloats[0], resultFloats[1], resultFloats[2], resultFloats[3]);
}
}
public override void OnUpdate()
{
base.OnUpdate();
if(isRunning)
{
UpdateVariableValue();
}
if(finishInNextStep)
{
if(!looping)
{
Finish();
Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep)
{
UpdateVariableValue();
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 586d3af17311b5c46ab9ac5d3796b7f8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Float Variable using an Animation Curve.")]
public class AnimateFloat : FsmStateAction
{
[RequiredField]
[Tooltip("The animation curve to use.")]
public FsmAnimationCurve animCurve;
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The float variable to set.")]
public FsmFloat floatVariable;
[Tooltip("Optionally send an Event when the animation finishes.")]
public FsmEvent finishEvent;
[Tooltip("Ignore TimeScale. Useful if the game is paused.")]
public bool realTime;
private float startTime;
private float currentTime;
private float endTime;
private bool looping;
public override void Reset()
{
animCurve = null;
floatVariable = null;
finishEvent = null;
realTime = false;
}
public override void OnEnter()
{
startTime = FsmTime.RealtimeSinceStartup;
currentTime = 0f;
if (animCurve != null && animCurve.curve != null && animCurve.curve.keys.Length > 0)
{
endTime = animCurve.curve.keys[animCurve.curve.length-1].time;
looping = ActionHelpers.IsLoopingWrapMode(animCurve.curve.postWrapMode);
}
else
{
Finish();
return;
}
floatVariable.Value = animCurve.curve.Evaluate(0);
}
public override void OnUpdate()
{
// update time
if (realTime)
{
currentTime = FsmTime.RealtimeSinceStartup - startTime;
}
else
{
currentTime += Time.deltaTime;
}
// update animation
if (animCurve != null && animCurve.curve != null && floatVariable != null)
{
floatVariable.Value = animCurve.curve.Evaluate(currentTime);
}
// send finish event
if (currentTime >= endTime)
{
if (!looping)
{
Finish();
}
if (finishEvent != null)
{
Fsm.Event(finishEvent);
}
}
}
#if UNITY_EDITOR
public override float GetProgress()
{
return Mathf.Min(currentTime/endTime , 1f);
}
#endif
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 5e775993337e0034e97e098d6575306c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Float Variable using an Animation Curve.")]
public class AnimateFloatV2: AnimateFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatVariable;
[RequiredField]
public FsmAnimationCurve animCurve;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to floatVariable")]
public Calculation calculation;
private bool finishInNextStep = false;
public override void Reset()
{
base.Reset();
floatVariable = new FsmFloat{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[1];
fromFloats = new float[1];
fromFloats[0] = floatVariable.IsNone ? 0f : floatVariable.Value;
calculations = new Calculation[1];
calculations[0] = calculation;
curves = new AnimationCurve[1];
curves[0] = animCurve.curve;
//call Init after you have initialized curves array
Init();
}
public override void OnExit()
{
}
public override void OnUpdate()
{
base.OnUpdate();
if(!floatVariable.IsNone && isRunning){
floatVariable.Value = resultFloats[0];
}
if(finishInNextStep){
if(!looping) {
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep){
if(!floatVariable.IsNone){
floatVariable.Value = resultFloats[0];
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 746a13fb4786bc247a7248536b9a3890
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
This diff is collapsed.
fileFormatVersion: 2
guid: b94df5cd261931745bcc35e1aa451330
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using System;
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("AnimateVariables")]
[Tooltip("Animates the value of a Rect Variable using an Animation Curve.")]
public class AnimateRect : AnimateFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmRect rectVariable;
[RequiredField]
public FsmAnimationCurve curveX;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to rectVariable.x.")]
public Calculation calculationX;
[RequiredField]
public FsmAnimationCurve curveY;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to rectVariable.y.")]
public Calculation calculationY;
[RequiredField]
public FsmAnimationCurve curveW;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to rectVariable.width.")]
public Calculation calculationW;
[RequiredField]
public FsmAnimationCurve curveH;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to rectVariable.height.")]
public Calculation calculationH;
private bool finishInNextStep;
public override void Reset()
{
base.Reset();
rectVariable = new FsmRect{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[4];
fromFloats = new float[4];
fromFloats[0] = rectVariable.IsNone ? 0f : rectVariable.Value.x;
fromFloats[1] = rectVariable.IsNone ? 0f : rectVariable.Value.y;
fromFloats[2] = rectVariable.IsNone ? 0f : rectVariable.Value.width;
fromFloats[3] = rectVariable.IsNone ? 0f : rectVariable.Value.height;
curves = new AnimationCurve[4];
curves[0] = curveX.curve;
curves[1] = curveY.curve;
curves[2] = curveW.curve;
curves[3] = curveH.curve;
calculations = new Calculation[4];
calculations[0] = calculationX;
calculations[1] = calculationY;
calculations[2] = calculationW;
calculations[3] = calculationH;
Init();
if (Math.Abs(delay.Value) < 0.01f)
{
UpdateVariableValue();
}
}
private void UpdateVariableValue()
{
if (!rectVariable.IsNone)
{
rectVariable.Value = new Rect(resultFloats[0], resultFloats[1], resultFloats[2], resultFloats[3]);
}
}
public override void OnUpdate()
{
base.OnUpdate();
if (isRunning)
{
UpdateVariableValue();
}
if (finishInNextStep)
{
if(!looping)
{
Finish();
Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep)
{
UpdateVariableValue();
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 4683a6d913750504f830330947fddac8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using System;
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Vector3 Variable using an Animation Curve.")]
public class AnimateVector3 : AnimateFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmVector3 vectorVariable;
[RequiredField]
public FsmAnimationCurve curveX;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to vectorVariable.x.")]
public Calculation calculationX;
[RequiredField]
public FsmAnimationCurve curveY;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to vectorVariable.y.")]
public Calculation calculationY;
[RequiredField]
public FsmAnimationCurve curveZ;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to vectorVariable.z.")]
public Calculation calculationZ;
private bool finishInNextStep;
public override void Reset()
{
base.Reset();
vectorVariable = new FsmVector3{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[3];
fromFloats = new float[3];
fromFloats[0] = vectorVariable.IsNone ? 0f : vectorVariable.Value.x;
fromFloats[1] = vectorVariable.IsNone ? 0f : vectorVariable.Value.y;
fromFloats[2] = vectorVariable.IsNone ? 0f : vectorVariable.Value.z;
curves = new AnimationCurve[3];
curves[0] = curveX.curve;
curves[1] = curveY.curve;
curves[2] = curveZ.curve;
calculations = new Calculation[3];
calculations[0] = calculationX;
calculations[1] = calculationY;
calculations[2] = calculationZ;
Init();
// Set initial value
if (Math.Abs(delay.Value) < 0.01f)
{
UpdateVariableValue();
}
}
private void UpdateVariableValue()
{
if (!vectorVariable.IsNone)
{
vectorVariable.Value = new Vector3(resultFloats[0], resultFloats[1], resultFloats[2]);
}
}
public override void OnUpdate()
{
base.OnUpdate();
if(isRunning)
{
UpdateVariableValue();
}
if(finishInNextStep)
{
if(!looping)
{
Finish();
Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep)
{
UpdateVariableValue();
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 096d312d970839340bb0b73993a5217e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Color Variable FROM-TO with assistance of Deformation Curves.")]
public class CurveColor: CurveFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmColor colorVariable;
[RequiredField]
public FsmColor fromValue;
[RequiredField]
public FsmColor toValue;
[RequiredField]
public FsmAnimationCurve curveR;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.Red and toValue.Rec.")]
public Calculation calculationR;
[RequiredField]
public FsmAnimationCurve curveG;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.Green and toValue.Green.")]
public Calculation calculationG;
[RequiredField]
public FsmAnimationCurve curveB;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.Blue and toValue.Blue.")]
public Calculation calculationB;
[RequiredField]
public FsmAnimationCurve curveA;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.Alpha and toValue.Alpha.")]
public Calculation calculationA;
Color clr;
private bool finishInNextStep = false;
public override void Reset()
{
base.Reset();
colorVariable = new FsmColor{UseVariable=true};
toValue = new FsmColor{UseVariable=true};
fromValue = new FsmColor{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[4];
fromFloats = new float[4];
fromFloats[0] = fromValue.IsNone ? 0f : fromValue.Value.r;
fromFloats[1] = fromValue.IsNone ? 0f : fromValue.Value.g;
fromFloats[2] = fromValue.IsNone ? 0f : fromValue.Value.b;
fromFloats[3] = fromValue.IsNone ? 0f : fromValue.Value.a;
toFloats = new float[4];
toFloats[0] = toValue.IsNone ? 0f : toValue.Value.r;
toFloats[1] = toValue.IsNone ? 0f : toValue.Value.g;
toFloats[2] = toValue.IsNone ? 0f : toValue.Value.b;
toFloats[3] = toValue.IsNone ? 0f : toValue.Value.a;
curves = new AnimationCurve[4];
curves[0] = curveR.curve;
curves[1] = curveG.curve;
curves[2] = curveB.curve;
curves[3] = curveA.curve;
calculations = new Calculation[4];
calculations[0] = calculationR;
calculations[1] = calculationG;
calculations[2] = calculationB;
calculations[3] = calculationA;
//call Init after you have initialized curves array
Init();
}
public override void OnExit()
{
}
public override void OnUpdate()
{
base.OnUpdate();
if(!colorVariable.IsNone && isRunning){
clr = new Color(resultFloats[0], resultFloats[1], resultFloats[2], resultFloats[3]);
colorVariable.Value = clr;
}
if(finishInNextStep){
if(!looping) {
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep){
if(!colorVariable.IsNone){
clr = new Color(resultFloats[0], resultFloats[1], resultFloats[2], resultFloats[3]);
colorVariable.Value = clr;
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 2b5ecf704915e1c47a236d3a9e13e1d8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Float Variable FROM-TO with assistance of Deformation Curve.")]
public class CurveFloat: CurveFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat floatVariable;
[RequiredField]
public FsmFloat fromValue;
[RequiredField]
public FsmFloat toValue;
[RequiredField]
public FsmAnimationCurve animCurve;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue and toValue.")]
public Calculation calculation;
private bool finishInNextStep = false;
public override void Reset()
{
base.Reset();
floatVariable = new FsmFloat{UseVariable=true};
toValue = new FsmFloat{UseVariable=true};
fromValue = new FsmFloat{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[1];
fromFloats = new float[1];
fromFloats[0] = fromValue.IsNone ? 0f : fromValue.Value;
toFloats = new float[1];
toFloats[0] = toValue.IsNone ? 0f : toValue.Value;
calculations = new Calculation[1];
calculations[0] = calculation;
curves = new AnimationCurve[1];
curves[0] = animCurve.curve;
//call Init after you have initialized curves array
Init();
}
public override void OnExit()
{
}
public override void OnUpdate()
{
base.OnUpdate();
if(!floatVariable.IsNone && isRunning){
floatVariable.Value = resultFloats[0];
}
if(finishInNextStep){
if(!looping) {
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep){
if(!floatVariable.IsNone){
floatVariable.Value = resultFloats[0];
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 8df028d2f13f5914482be2a14d98f4b6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[Tooltip("Animate base action - DON'T USE IT!")]
public abstract class CurveFsmAction : FsmStateAction
{
[Tooltip("Define animation time, scaling the curve to fit.")]
public FsmFloat time;
[Tooltip("If you define speed, your animation will speed up or slow down.")]
public FsmFloat speed;
[Tooltip("Delayed animation start.")]
public FsmFloat delay;
[Tooltip("Animation curve start from any time. If IgnoreCurveOffset is true the animation starts right after the state become entered.")]
public FsmBool ignoreCurveOffset;
[Tooltip("Optionally send an Event when the animation finishes.")]
public FsmEvent finishEvent;
[Tooltip("Ignore TimeScale. Useful if the game is paused.")]
public bool realTime;
private float startTime;
private float currentTime;
private float[] endTimes;
private float lastTime;
private float deltaTime;
private float delayTime;
private float[] keyOffsets;
protected AnimationCurve[] curves;
protected Calculation[] calculations;
protected float[] resultFloats;
protected float[] fromFloats;
protected float[] toFloats;
private float[] distances;
protected bool finishAction = false;
protected bool isRunning;
protected bool looping;
private bool start = false;
private float largestEndTime = 0f;
public enum Calculation{
None,
AddToValue,
SubtractFromValue,
SubtractValueFromCurve,
MultiplyValue,
DivideValue,
DivideCurveByValue,
}
public override void Reset()
{
finishEvent = null;
realTime = false;
time = new FsmFloat { UseVariable = true };
speed = new FsmFloat { UseVariable = true };
delay = new FsmFloat { UseVariable = true };
ignoreCurveOffset = new FsmBool{ Value = true};
resultFloats = new float[0];
fromFloats = new float[0];
toFloats = new float[0];
distances = new float[0];
endTimes = new float[0];
keyOffsets = new float[0];
curves = new AnimationCurve[0];
finishAction = false;
start = false;
}
public override void OnEnter()
{
startTime = FsmTime.RealtimeSinceStartup;
lastTime = FsmTime.RealtimeSinceStartup - startTime;
deltaTime = 0f;
currentTime = 0f;
isRunning = false;
finishAction = false;
looping = false;
delayTime = delay.IsNone ? 0f : delayTime = delay.Value;
start = true;
}
protected void Init(){
endTimes = new float[curves.Length];
keyOffsets = new float[curves.Length];
largestEndTime = 0f;
for(int i = 0; i<curves.Length;i++){
if (curves[i] != null && curves[i].keys.Length > 0)
{
keyOffsets[i] = curves[i].keys.Length > 0 ? (time.IsNone ? curves[i].keys[0].time : (time.Value/curves[i].keys[curves[i].length-1].time)*curves[i].keys[0].time) : 0f;
currentTime = ignoreCurveOffset.IsNone ? 0f : (ignoreCurveOffset.Value ? keyOffsets[i] : 0f);
if(!time.IsNone) endTimes[i] = time.Value;
else endTimes[i] = curves[i].keys[curves[i].length-1].time;
if(largestEndTime < endTimes[i]) largestEndTime = endTimes[i];
if(!looping) looping = ActionHelpers.IsLoopingWrapMode(curves[i].postWrapMode);
} else {
endTimes[i] = -1f;
}
}
for(int i = 0; i<curves.Length;i++){
if(largestEndTime > 0f && endTimes[i] == -1f) endTimes[i] = largestEndTime;
else {
if(largestEndTime == 0f && endTimes[i] == -1f) {
if(time.IsNone) endTimes[i] = 1f;
else endTimes[i] = time.Value;
}
}
}
distances = new float[fromFloats.Length];
for(int i = 0; i<fromFloats.Length; i++){
distances[i] = toFloats[i] - fromFloats[i];
}
}
public override void OnUpdate()
{
// update time
if(!isRunning && start){
if(delayTime >= 0) {
if(realTime){
deltaTime = (FsmTime.RealtimeSinceStartup - startTime) - lastTime;
lastTime = FsmTime.RealtimeSinceStartup - startTime;
delayTime -= deltaTime;
} else {
delayTime -= Time.deltaTime;
}
} else {
isRunning = true;
start = false;
startTime = FsmTime.RealtimeSinceStartup;
lastTime = FsmTime.RealtimeSinceStartup - startTime;
}
}
if(isRunning && !finishAction){
if (realTime)
{
deltaTime = (FsmTime.RealtimeSinceStartup - startTime) - lastTime;
lastTime = FsmTime.RealtimeSinceStartup - startTime;
if(!speed.IsNone) currentTime += deltaTime*speed.Value;
else currentTime += deltaTime;
}
else
{
if(!speed.IsNone) currentTime += Time.deltaTime*speed.Value;
else currentTime += Time.deltaTime;
}
// update animation
for(var k = 0; k<curves.Length;k++){
if (curves[k] != null && curves[k].keys.Length > 0)
{
if(calculations[k] != CurveFsmAction.Calculation.None){
switch(calculations[k]){
case Calculation.AddToValue:
if(!time.IsNone) resultFloats[k] = fromFloats[k] + (distances[k]*(currentTime/time.Value) + curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time));
else resultFloats[k] = fromFloats[k] + (distances[k]*(currentTime/endTimes[k]) + curves[k].Evaluate(currentTime));
break;
case Calculation.SubtractFromValue:
if(!time.IsNone) resultFloats[k] = fromFloats[k] + (distances[k]*(currentTime/time.Value) - curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time));
else resultFloats[k] = fromFloats[k] + (distances[k]*(currentTime/endTimes[k]) - curves[k].Evaluate(currentTime));
break;
case Calculation.SubtractValueFromCurve:
if(!time.IsNone) resultFloats[k] = (curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time) - distances[k]*(currentTime/time.Value)) + fromFloats[k];
else resultFloats[k] = (curves[k].Evaluate(currentTime) - distances[k]*(currentTime/endTimes[k])) + fromFloats[k];
break;
case Calculation.MultiplyValue:
if(!time.IsNone) resultFloats[k] = (curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time) * distances[k]*(currentTime/time.Value)) + fromFloats[k];
else resultFloats[k] = (curves[k].Evaluate(currentTime) * distances[k]*(currentTime/endTimes[k])) + fromFloats[k];
break;
case Calculation.DivideValue :
if(!time.IsNone) resultFloats[k] = curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time) != 0f
? fromFloats[k]+ (distances[k]*(currentTime/time.Value))/curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time) : float.MaxValue;
else resultFloats[k] = curves[k].Evaluate(currentTime) != 0
? fromFloats[k] + (distances[k]*(currentTime/endTimes[k]))/curves[k].Evaluate(currentTime) : float.MaxValue;
break;
case Calculation.DivideCurveByValue :
if(!time.IsNone) resultFloats[k] = fromFloats[k] != 0f
? curves[k].Evaluate((currentTime/time.Value)*curves[k].keys[curves[k].length-1].time)/(distances[k]*(currentTime/time.Value)) + fromFloats[k] : float.MaxValue;
else resultFloats[k] = fromFloats[k] != 0
? curves[k].Evaluate(currentTime)/(distances[k]*(currentTime/endTimes[k])) + fromFloats[k] : float.MaxValue;
break;
}
} else {
//Linear interpolation between color components
if(!time.IsNone) resultFloats[k] = (fromFloats[k] + distances[k]*(currentTime/time.Value));
else resultFloats[k] = (fromFloats[k] + distances[k]*(currentTime/endTimes[k]));
}
} else {
if(!time.IsNone) resultFloats[k] = (fromFloats[k] + distances[k]*(currentTime/time.Value));
else {
if(largestEndTime == 0f){
resultFloats[k] = (fromFloats[k] + distances[k]*(currentTime/1f));
} else {
resultFloats[k] = (fromFloats[k] + distances[k]*(currentTime/largestEndTime));
}
}
}
}
if(isRunning) {
finishAction = true;
for(int i = 0; i<endTimes.Length;i++){
//Debug.Log(i.ToString() + "| " +endTimes[i].ToString() + " " + currentTime.ToString());
if(currentTime < endTimes[i]) finishAction = false;
}
isRunning = !finishAction;
}
}
}
#if UNITY_EDITOR
public override float GetProgress()
{
float maxendtime = 0f;
for (int i = 0; i < endTimes.Length; i++)
{
maxendtime = Mathf.Max (maxendtime, endTimes [i]);
}
return Mathf.Min(currentTime/maxendtime , 1f);
}
#endif
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: fb99e798c2fbc254f96283acdd3cfcf1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("AnimateVariables")]
[Tooltip("Animates the value of a Rect Variable FROM-TO with assistance of Deformation Curves.")]
public class CurveRect: CurveFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmRect rectVariable;
[RequiredField]
public FsmRect fromValue;
[RequiredField]
public FsmRect toValue;
[RequiredField]
public FsmAnimationCurve curveX;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.x and toValue.x.")]
public Calculation calculationX;
[RequiredField]
public FsmAnimationCurve curveY;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.y and toValue.y.")]
public Calculation calculationY;
[RequiredField]
public FsmAnimationCurve curveW;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.width and toValue.width.")]
public Calculation calculationW;
[RequiredField]
public FsmAnimationCurve curveH;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.height and toValue.height.")]
public Calculation calculationH;
Rect rct;
private bool finishInNextStep = false;
public override void Reset()
{
base.Reset();
rectVariable = new FsmRect{UseVariable=true};
toValue = new FsmRect{UseVariable=true};
fromValue = new FsmRect{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[4];
fromFloats = new float[4];
fromFloats[0] = fromValue.IsNone ? 0f : fromValue.Value.x;
fromFloats[1] = fromValue.IsNone ? 0f : fromValue.Value.y;
fromFloats[2] = fromValue.IsNone ? 0f : fromValue.Value.width;
fromFloats[3] = fromValue.IsNone ? 0f : fromValue.Value.height;
toFloats = new float[4];
toFloats[0] = toValue.IsNone ? 0f : toValue.Value.x;
toFloats[1] = toValue.IsNone ? 0f : toValue.Value.y;
toFloats[2] = toValue.IsNone ? 0f : toValue.Value.width;
toFloats[3] = toValue.IsNone ? 0f : toValue.Value.height;
curves = new AnimationCurve[4];
curves[0] = curveX.curve;
curves[1] = curveY.curve;
curves[2] = curveW.curve;
curves[3] = curveH.curve;
calculations = new Calculation[4];
calculations[0] = calculationX;
calculations[1] = calculationY;
calculations[2] = calculationW;
calculations[2] = calculationH;
//call Init after you have initialized curves array
Init();
}
public override void OnExit()
{
}
public override void OnUpdate()
{
base.OnUpdate();
if(!rectVariable.IsNone && isRunning){
rct = new Rect(resultFloats[0], resultFloats[1], resultFloats[2], resultFloats[3]);
rectVariable.Value = rct;
}
if(finishInNextStep){
if(!looping) {
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep){
if(!rectVariable.IsNone){
rct = new Rect(resultFloats[0], resultFloats[1], resultFloats[2], resultFloats[3]);
rectVariable.Value = rct;
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: ea6f61332d0bea74485ff1d0c8e4ce75
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Animates the value of a Vector3 Variable FROM-TO with assistance of Deformation Curves.")]
public class CurveVector3: CurveFsmAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmVector3 vectorVariable;
[RequiredField]
public FsmVector3 fromValue;
[RequiredField]
public FsmVector3 toValue;
[RequiredField]
public FsmAnimationCurve curveX;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.x and toValue.x.")]
public Calculation calculationX;
[RequiredField]
public FsmAnimationCurve curveY;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.y and toValue.y.")]
public Calculation calculationY;
[RequiredField]
public FsmAnimationCurve curveZ;
[Tooltip("Calculation lets you set a type of curve deformation that will be applied to otherwise linear move between fromValue.z and toValue.z.")]
public Calculation calculationZ;
Vector3 vct;
private bool finishInNextStep = false;
public override void Reset()
{
base.Reset();
vectorVariable = new FsmVector3{UseVariable=true};
toValue = new FsmVector3{UseVariable=true};
fromValue = new FsmVector3{UseVariable=true};
}
public override void OnEnter()
{
base.OnEnter();
finishInNextStep = false;
resultFloats = new float[3];
fromFloats = new float[3];
fromFloats[0] = fromValue.IsNone ? 0f : fromValue.Value.x;
fromFloats[1] = fromValue.IsNone ? 0f : fromValue.Value.y;
fromFloats[2] = fromValue.IsNone ? 0f : fromValue.Value.z;
toFloats = new float[3];
toFloats[0] = toValue.IsNone ? 0f : toValue.Value.x;
toFloats[1] = toValue.IsNone ? 0f : toValue.Value.y;
toFloats[2] = toValue.IsNone ? 0f : toValue.Value.z;
curves = new AnimationCurve[3];
curves[0] = curveX.curve;
curves[1] = curveY.curve;
curves[2] = curveZ.curve;
calculations = new Calculation[3];
calculations[0] = calculationX;
calculations[1] = calculationY;
calculations[2] = calculationZ;
//call Init after you have initialized curves array
Init();
}
public override void OnExit()
{
}
public override void OnUpdate()
{
base.OnUpdate();
if(!vectorVariable.IsNone && isRunning){
vct = new Vector3(resultFloats[0], resultFloats[1], resultFloats[2]);
vectorVariable.Value = vct;
}
if(finishInNextStep){
if(!looping) {
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
}
if(finishAction && !finishInNextStep){
if(!vectorVariable.IsNone){
vct = new Vector3(resultFloats[0], resultFloats[1], resultFloats[2]);
vectorVariable.Value = vct;
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 14d5c12ee3042144ea0c7ca086f0ab6f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Easing Animation - Color")]
public class EaseColor : EaseFsmAction
{
[RequiredField]
public FsmColor fromValue;
[RequiredField]
public FsmColor toValue;
[UIHint(UIHint.Variable)]
public FsmColor colorVariable;
private bool finishInNextStep = false;
public override void Reset (){
base.Reset();
colorVariable = null;
fromValue = null;
toValue = null;
finishInNextStep = false;
}
public override void OnEnter ()
{
base.OnEnter();
fromFloats = new float[4];
fromFloats[0] = fromValue.Value.r;
fromFloats[1] = fromValue.Value.g;
fromFloats[2] = fromValue.Value.b;
fromFloats[3] = fromValue.Value.a;
toFloats = new float[4];
toFloats[0] = toValue.Value.r;
toFloats[1] = toValue.Value.g;
toFloats[2] = toValue.Value.b;
toFloats[3] = toValue.Value.a;
resultFloats = new float[4];
finishInNextStep = false;
colorVariable.Value = fromValue.Value;
}
public override void OnExit (){
base.OnExit();
}
public override void OnUpdate(){
base.OnUpdate();
if(!colorVariable.IsNone && isRunning){
colorVariable.Value = new Color(resultFloats[0],resultFloats[1],resultFloats[2], resultFloats[3]);
}
if(finishInNextStep){
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
if(finishAction && !finishInNextStep){
if(!colorVariable.IsNone){
colorVariable.Value = new Color(reverse.IsNone ? toValue.Value.r : reverse.Value ? fromValue.Value.r : toValue.Value.r,
reverse.IsNone ? toValue.Value.g : reverse.Value ? fromValue.Value.g : toValue.Value.g,
reverse.IsNone ? toValue.Value.b : reverse.Value ? fromValue.Value.b : toValue.Value.b,
reverse.IsNone ? toValue.Value.a : reverse.Value ? fromValue.Value.a : toValue.Value.a
);
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: dad5426318ed96942a8a501e2635a8c6
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Easing Animation - Float")]
public class EaseFloat : EaseFsmAction
{
[RequiredField]
public FsmFloat fromValue;
[RequiredField]
public FsmFloat toValue;
[UIHint(UIHint.Variable)]
public FsmFloat floatVariable;
private bool finishInNextStep = false;
public override void Reset (){
base.Reset();
floatVariable = null;
fromValue = null;
toValue = null;
finishInNextStep = false;
}
public override void OnEnter ()
{
base.OnEnter();
fromFloats = new float[1];
fromFloats[0] = fromValue.Value;
toFloats = new float[1];
toFloats[0] = toValue.Value;
resultFloats = new float[1];
finishInNextStep = false;
floatVariable.Value = fromValue.Value;
}
public override void OnExit (){
base.OnExit();
}
public override void OnUpdate(){
base.OnUpdate();
if(!floatVariable.IsNone && isRunning){
floatVariable.Value = resultFloats[0];
}
if(finishInNextStep){
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
if(finishAction && !finishInNextStep){
if(!floatVariable.IsNone){
floatVariable.Value = reverse.IsNone ? toValue.Value : reverse.Value ? fromValue.Value : toValue.Value;
}
finishInNextStep = true;
}
}
#if UNITY_EDITOR
public override string AutoName()
{
return ActionHelpers.AutoNameRange(this, fromValue, toValue) + " " + easeType;
}
#endif
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 15e175c518c552040b2203583474c32a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
This diff is collapsed.
fileFormatVersion: 2
guid: 652d636e5afe3ee4ebe97f2b8a6db58f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("AnimateVariables")]
[Tooltip("Easing Animation - Rect.")]
public class EaseRect : EaseFsmAction
{
[RequiredField]
public FsmRect fromValue;
[RequiredField]
public FsmRect toValue;
[UIHint(UIHint.Variable)]
public FsmRect rectVariable;
private bool finishInNextStep = false;
public override void Reset (){
base.Reset();
rectVariable = null;
fromValue = null;
toValue = null;
finishInNextStep = false;
}
public override void OnEnter ()
{
base.OnEnter();
fromFloats = new float[4];
fromFloats[0] = fromValue.Value.x;
fromFloats[1] = fromValue.Value.y;
fromFloats[2] = fromValue.Value.width;
fromFloats[3] = fromValue.Value.height;
toFloats = new float[4];
toFloats[0] = toValue.Value.x;
toFloats[1] = toValue.Value.y;
toFloats[2] = toValue.Value.width;
toFloats[3] = toValue.Value.height;
resultFloats = new float[4];
finishInNextStep = false;
rectVariable.Value = fromValue.Value;
}
public override void OnExit (){
base.OnExit();
}
public override void OnUpdate(){
base.OnUpdate();
if(!rectVariable.IsNone && isRunning){
rectVariable.Value = new Rect(resultFloats[0],resultFloats[1],resultFloats[2], resultFloats[3]);
}
if(finishInNextStep){
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
if(finishAction && !finishInNextStep){
if(!rectVariable.IsNone){
rectVariable.Value = new Rect(reverse.IsNone ? toValue.Value.x : reverse.Value ? fromValue.Value.x : toValue.Value.x,
reverse.IsNone ? toValue.Value.y : reverse.Value ? fromValue.Value.y : toValue.Value.y,
reverse.IsNone ? toValue.Value.width : reverse.Value ? fromValue.Value.width : toValue.Value.width,
reverse.IsNone ? toValue.Value.height : reverse.Value ? fromValue.Value.height : toValue.Value.height
);
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: c7149467973e052458a62dbd4dbc91c1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.AnimateVariables)]
[Tooltip("Easing Animation - Vector3")]
public class EaseVector3 : EaseFsmAction
{
[RequiredField]
public FsmVector3 fromValue;
[RequiredField]
public FsmVector3 toValue;
[UIHint(UIHint.Variable)]
public FsmVector3 vector3Variable;
private bool finishInNextStep = false;
public override void Reset (){
base.Reset();
vector3Variable = null;
fromValue = null;
toValue = null;
finishInNextStep = false;
}
public override void OnEnter ()
{
base.OnEnter();
fromFloats = new float[3];
fromFloats[0] = fromValue.Value.x;
fromFloats[1] = fromValue.Value.y;
fromFloats[2] = fromValue.Value.z;
toFloats = new float[3];
toFloats[0] = toValue.Value.x;
toFloats[1] = toValue.Value.y;
toFloats[2] = toValue.Value.z;
resultFloats = new float[3];
finishInNextStep = false;
vector3Variable.Value = fromValue.Value;
}
public override void OnExit (){
base.OnExit();
}
public override void OnUpdate(){
base.OnUpdate();
if(!vector3Variable.IsNone && isRunning){
vector3Variable.Value = new Vector3(resultFloats[0],resultFloats[1],resultFloats[2]);
}
if(finishInNextStep){
Finish();
if(finishEvent != null) Fsm.Event(finishEvent);
}
if(finishAction && !finishInNextStep){
if(!vector3Variable.IsNone){
vector3Variable.Value = new Vector3(reverse.IsNone ? toValue.Value.x : reverse.Value ? fromValue.Value.x : toValue.Value.x,
reverse.IsNone ? toValue.Value.y : reverse.Value ? fromValue.Value.y : toValue.Value.y,
reverse.IsNone ? toValue.Value.z : reverse.Value ? fromValue.Value.z : toValue.Value.z
);
}
finishInNextStep = true;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 94f53459012912c41aaa91782fd12bb1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
fileFormatVersion: 2
guid: 46245649d52953640b7095b573d2ff3c
folderAsset: yes
timeCreated: 1504501372
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Adds a named Animation Clip to a Game Object. Optionally trims the Animation.")]
public class AddAnimationClip : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("The GameObject to add the Animation Clip to.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[ObjectType(typeof(AnimationClip))]
[Tooltip("The animation clip to add. NOTE: Make sure the clip is compatible with the object's hierarchy.")]
public FsmObject animationClip;
[RequiredField]
[Tooltip("Name the animation. Used by other actions to reference this animation.")]
public FsmString animationName;
[Tooltip("Optionally trim the animation by specifying a first and last frame.")]
public FsmInt firstFrame;
[Tooltip("Optionally trim the animation by specifying a first and last frame.")]
public FsmInt lastFrame;
[Tooltip("Add an extra looping frame that matches the first frame.")]
public FsmBool addLoopFrame;
public override void Reset()
{
gameObject = null;
animationClip = null;
animationName = "";
firstFrame = 0;
lastFrame = 0;
addLoopFrame = false;
}
public override void OnEnter()
{
DoAddAnimationClip();
Finish();
}
void DoAddAnimationClip()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}
var animClip = animationClip.Value as AnimationClip;
if (animClip == null)
{
return;
}
var animation = go.GetComponent<Animation>();
if (firstFrame.Value == 0 && lastFrame.Value == 0)
{
animation.AddClip(animClip, animationName.Value);
}
else
{
animation.AddClip(animClip, animationName.Value, firstFrame.Value, lastFrame.Value, addLoopFrame.Value);
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 8b9bc61aa3cfd0e43818e823d44ac217
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Play an animation on a subset of the hierarchy. E.g., A waving animation on the upper body.")]
public class AddMixingTransform : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("The GameObject playing the animation.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[Tooltip("The name of the animation to mix. NOTE: The animation should already be added to the Animation Component on the GameObject.")]
public FsmString animationName;
[RequiredField]
[Tooltip("The mixing transform. E.g., root/upper_body/left_shoulder")]
public FsmString transform;
[Tooltip("If recursive is true all children of the mix transform will also be animated.")]
public FsmBool recursive;
public override void Reset()
{
gameObject = null;
animationName = "";
transform = "";
recursive = true;
}
public override void OnEnter()
{
DoAddMixingTransform();
Finish();
}
void DoAddMixingTransform()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (!UpdateCache(go))
{
return;
}
var animClip = animation[animationName.Value];
if (animClip == null)
{
return;
}
var mixingTransform = go.transform.Find(transform.Value);
animClip.AddMixingTransform(mixingTransform, recursive.Value);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: a6cff7a6b1eb9d840aac5db6552a2780
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Set the Wrap Mode, Blend Mode, Layer and Speed of an Animation.\nNOTE: Settings are applied once, on entering the state, NOT continuously. To dynamically control an animation's settings, use Set Animation Speed etc.")]
public class AnimationSettings : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("A GameObject with an Animation Component.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Animation)]
[Tooltip("The name of the animation.")]
public FsmString animName;
[Tooltip("The behavior of the animation when it wraps.")]
public WrapMode wrapMode;
[Tooltip("How the animation is blended with other animations on the Game Object.")]
public AnimationBlendMode blendMode;
[HasFloatSlider(0f, 5f)]
[Tooltip("The speed of the animation. 1 = normal; 2 = double speed...")]
public FsmFloat speed;
[Tooltip("The animation layer")]
public FsmInt layer;
public override void Reset()
{
gameObject = null;
animName = null;
wrapMode = WrapMode.Loop;
blendMode = AnimationBlendMode.Blend;
speed = 1.0f;
layer = 0;
}
public override void OnEnter()
{
DoAnimationSettings();
Finish();
}
private void DoAnimationSettings()
{
if (string.IsNullOrEmpty(animName.Value))
{
return;
}
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (!UpdateCache(go))
{
return;
}
var anim = animation[animName.Value];
if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
return;
}
anim.wrapMode = wrapMode;
anim.blendMode = blendMode;
if (!layer.IsNone)
{
anim.layer = layer.Value;
}
if (!speed.IsNone)
{
anim.speed = speed.Value;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 6f1da104999d6b144b9e1d7cff19f8e9
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
// Base class for logging actions
public abstract class BaseAnimationAction : ComponentAction<Animation>
{
//#if UNITY_EDITOR
public override void OnActionTargetInvoked(object targetObject)
{
var animClip = targetObject as AnimationClip;
if (animClip == null) return;
var animationComponent = Owner.GetComponent<Animation>();
if (animationComponent != null)
{
animationComponent.AddClip(animClip, animClip.name);
}
}
//#endif
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: ce8daff68704b6449ae96e8e79b6fc18
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Blends an Animation towards a Target Weight over a specified Time.\nOptionally sends an Event when finished.")]
public class BlendAnimation : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("The GameObject to animate.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Animation)]
[Tooltip("The name of the animation to blend.")]
public FsmString animName;
[RequiredField]
[HasFloatSlider(0f, 1f)]
[Tooltip("Target weight to blend to.")]
public FsmFloat targetWeight;
[RequiredField]
[HasFloatSlider(0f, 5f)]
[Tooltip("How long should the blend take.")]
public FsmFloat time;
[Tooltip("Event to send when the blend has finished.")]
public FsmEvent finishEvent;
// TODO: Delayed event doesn't handle speed changes etc.
// Use Animation isPlaying instead?
DelayedEvent delayedFinishEvent;
public override void Reset()
{
gameObject = null;
animName = null;
targetWeight = 1f;
time = 0.3f;
finishEvent = null;
}
public override void OnEnter()
{
DoBlendAnimation(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
}
public override void OnUpdate()
{
if (DelayedEvent.WasSent(delayedFinishEvent))
{
Finish();
}
}
void DoBlendAnimation(GameObject go)
{
if (go == null)
{
return;
}
var animation = go.GetComponent<Animation>();
if (animation == null)
{
LogWarning("Missing Animation component on GameObject: " + go.name);
Finish();
return;
}
var anim = animation[animName.Value];
if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
Finish();
return;
}
var timeValue = time.Value;
animation.Blend(animName.Value, targetWeight.Value, timeValue);
// TODO: doesn't work well with scaled time
if (finishEvent != null)
{
delayedFinishEvent = Fsm.DelayedEvent(finishEvent, anim.length);
}
else
{
Finish();
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: caaf16a32a7f8eb4fa362e719d2e901f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Captures the current pose of a hierarchy as an animation clip.\n\nUseful to blend from an arbitrary pose (e.g. a rag-doll death) back to a known animation (e.g. idle).")]
public class CapturePoseAsAnimationClip : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("The GameObject root of the hierarchy to capture.")]
public FsmOwnerDefault gameObject;
[Tooltip("Capture position keys.")]
public FsmBool position;
[Tooltip("Capture rotation keys.")]
public FsmBool rotation;
[Tooltip("Capture scale keys.")]
public FsmBool scale;
[RequiredField]
[UIHint(UIHint.Variable)]
[ObjectType(typeof(AnimationClip))]
[Tooltip("Store the result in an Object variable of type AnimationClip.")]
public FsmObject storeAnimationClip;
public override void Reset()
{
gameObject = null;
position = false;
rotation = true;
scale = false;
storeAnimationClip = null;
}
public override void OnEnter()
{
DoCaptureAnimationClip();
Finish();
}
void DoCaptureAnimationClip()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}
var animClip = new AnimationClip();
foreach (Transform child in go.transform)
{
CaptureTransform(child, "", animClip);
}
storeAnimationClip.Value = animClip;
}
void CaptureTransform(Transform transform, string path, AnimationClip clip)
{
path += transform.name;
//Debug.Log(path);
if (position.Value)
{
CapturePosition(transform, path, clip);
}
if (rotation.Value)
{
CaptureRotation(transform, path, clip);
}
if (scale.Value)
{
CaptureScale(transform, path, clip);
}
foreach (Transform child in transform)
{
CaptureTransform(child, path + "/", clip);
}
}
void CapturePosition(Transform transform, string path, AnimationClip clip)
{
SetConstantCurve(clip, path, "localPosition.x", transform.localPosition.x);
SetConstantCurve(clip, path, "localPosition.y", transform.localPosition.y);
SetConstantCurve(clip, path, "localPosition.z", transform.localPosition.z);
}
void CaptureRotation(Transform transform, string path, AnimationClip clip)
{
SetConstantCurve(clip, path, "localRotation.x", transform.localRotation.x);
SetConstantCurve(clip, path, "localRotation.y", transform.localRotation.y);
SetConstantCurve(clip, path, "localRotation.z", transform.localRotation.z);
SetConstantCurve(clip, path, "localRotation.w", transform.localRotation.w);
}
void CaptureScale(Transform transform, string path, AnimationClip clip)
{
SetConstantCurve(clip, path, "localScale.x", transform.localScale.x);
SetConstantCurve(clip, path, "localScale.y", transform.localScale.y);
SetConstantCurve(clip, path, "localScale.z", transform.localScale.z);
}
void SetConstantCurve(AnimationClip clip, string childPath, string propertyPath, float value)
{
var curve = AnimationCurve.Linear(0, value, 100, value);
curve.postWrapMode = WrapMode.Loop;
clip.SetCurve(childPath, typeof(Transform), propertyPath, curve);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: b879bd09b7eebe94782860779d5cc275
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Enables/Disables an Animation on a GameObject.\nAnimation time is paused while disabled. Animation must also have a non zero weight to play.")]
public class EnableAnimation : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("The GameObject playing the animation.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Animation)]
[Tooltip("The name of the animation to enable/disable.")]
public FsmString animName;
[RequiredField]
[Tooltip("Set to True to enable, False to disable.")]
public FsmBool enable;
[Tooltip("Reset the initial enabled state when exiting the state.")]
public FsmBool resetOnExit;
private AnimationState anim;
public override void Reset()
{
gameObject = null;
animName = null;
enable = true;
resetOnExit = false;
}
public override void OnEnter()
{
DoEnableAnimation(Fsm.GetOwnerDefaultTarget(gameObject));
Finish();
}
void DoEnableAnimation(GameObject go)
{
if (UpdateCache(go))
{
anim = animation[animName.Value];
if (anim != null)
{
anim.enabled = enable.Value;
}
}
}
public override void OnExit()
{
if (resetOnExit.Value && anim != null)
{
anim.enabled = !enable.Value;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 4e18e42fb3afda04aa50874569cb30f1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Plays an Animation on a Game Object. You can add named animation clips to the object in the Unity editor, or with the Add Animation Clip action.")]
public class PlayAnimation : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("Game Object to play the animation on.")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Animation)]
[Tooltip("The name of the animation to play.")]
public FsmString animName;
[Tooltip("How to treat previously playing animations.")]
public PlayMode playMode;
[HasFloatSlider(0f, 5f)]
[Tooltip("Time taken to blend to this animation.")]
public FsmFloat blendTime;
[Tooltip("Event to send when the animation is finished playing. NOTE: Not sent with Loop or PingPong wrap modes!")]
public FsmEvent finishEvent;
[Tooltip("Event to send when the animation loops. If you want to send this event to another FSM use Set Event Target. NOTE: This event is only sent with Loop and PingPong wrap modes.")]
public FsmEvent loopEvent;
[Tooltip("Stop playing the animation when this state is exited.")]
public bool stopOnExit;
private AnimationState anim;
private float prevAnimtTime;
public override void Reset()
{
gameObject = null;
animName = null;
playMode = PlayMode.StopAll;
blendTime = 0.3f;
finishEvent = null;
loopEvent = null;
stopOnExit = false;
}
public override void OnEnter()
{
DoPlayAnimation();
}
private void DoPlayAnimation()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (!UpdateCache(go))
{
Finish();
return;
}
if (string.IsNullOrEmpty(animName.Value))
{
LogWarning("Missing animName!");
Finish();
return;
}
anim = animation[animName.Value];
if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
Finish();
return;
}
var time = blendTime.Value;
if (time < 0.001f)
{
animation.Play(animName.Value, playMode);
}
else
{
animation.CrossFade(animName.Value, time, playMode);
}
prevAnimtTime = anim.time;
}
public override void OnUpdate()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null || anim == null)
{
return;
}
if (!anim.enabled || (anim.wrapMode == WrapMode.ClampForever && anim.time > anim.length))
{
Fsm.Event(finishEvent);
Finish();
}
if (anim.wrapMode != WrapMode.ClampForever && anim.time > anim.length && prevAnimtTime < anim.length)
{
Fsm.Event(loopEvent);
}
}
public override void OnExit()
{
if (stopOnExit)
{
StopAnimation();
}
}
private void StopAnimation()
{
if (animation != null)
{
animation.Stop(animName.Value);
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: a91b4f48a88067f46b95d5a5ff738443
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Plays a Random Animation on a Game Object. You can set the relative weight of each animation to control how often they are selected.")]
public class PlayRandomAnimation : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("Game Object to play the animation on.")]
public FsmOwnerDefault gameObject;
[CompoundArray("Animations", "Animation", "Weight")]
[UIHint(UIHint.Animation)]
public FsmString[] animations;
[HasFloatSlider(0, 1)]
public FsmFloat[] weights;
[Tooltip("How to treat previously playing animations.")]
public PlayMode playMode;
[HasFloatSlider(0f, 5f)]
[Tooltip("Time taken to blend to this animation.")]
public FsmFloat blendTime;
[Tooltip("Event to send when the animation is finished playing. NOTE: Not sent with Loop or PingPong wrap modes!")]
public FsmEvent finishEvent;
[Tooltip("Event to send when the animation loops. If you want to send this event to another FSM use Set Event Target. NOTE: This event is only sent with Loop and PingPong wrap modes.")]
public FsmEvent loopEvent;
[Tooltip("Stop playing the animation when this state is exited.")]
public bool stopOnExit;
private AnimationState anim;
private float prevAnimtTime;
public override void Reset()
{
gameObject = null;
animations = new FsmString[0];
weights = new FsmFloat[0];
playMode = PlayMode.StopAll;
blendTime = 0.3f;
finishEvent = null;
loopEvent = null;
stopOnExit = false;
}
public override void OnEnter()
{
DoPlayRandomAnimation();
}
void DoPlayRandomAnimation()
{
if (animations.Length > 0)
{
var randomIndex = ActionHelpers.GetRandomWeightedIndex(weights);
if (randomIndex != -1)
{
DoPlayAnimation(animations[randomIndex].Value);
}
}
}
void DoPlayAnimation(string animName)
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (!UpdateCache(go))
{
Finish();
return;
}
if (string.IsNullOrEmpty(animName))
{
LogWarning("Missing animName!");
Finish();
return;
}
anim = animation[animName];
if (anim == null)
{
LogWarning("Missing animation: " + animName);
Finish();
return;
}
var time = blendTime.Value;
if (time < 0.001f)
{
animation.Play(animName, playMode);
}
else
{
animation.CrossFade(animName, time, playMode);
}
prevAnimtTime = anim.time;
}
public override void OnUpdate()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null || anim == null)
{
return;
}
if (!anim.enabled || (anim.wrapMode == WrapMode.ClampForever && anim.time > anim.length))
{
Fsm.Event(finishEvent);
Finish();
}
if (anim.wrapMode != WrapMode.ClampForever && anim.time > anim.length && prevAnimtTime < anim.length)
{
Fsm.Event(loopEvent);
}
}
public override void OnExit()
{
if (stopOnExit)
{
StopAnimation();
}
}
void StopAnimation()
{
if (animation != null)
{
animation.Stop(anim.name);
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: c17b3e1c679e6aa4589c924799fb14fa
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Removes a mixing transform previously added with Add Mixing Transform. If transform has been added as recursive, then it will be removed as recursive. Once you remove all mixing transforms added to animation state all curves become animated again.")]
public class RemoveMixingTransform : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
[Tooltip("The GameObject playing the animation.")]
public FsmOwnerDefault gameObject;
[RequiredField]
[Tooltip("The name of the animation.")]
public FsmString animationName;
[RequiredField]
[Tooltip("The mixing transform to remove. E.g., root/upper_body/left_shoulder")]
public FsmString transfrom;
public override void Reset()
{
gameObject = null;
animationName = "";
}
public override void OnEnter()
{
DoRemoveMixingTransform();
Finish();
}
void DoRemoveMixingTransform()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (!UpdateCache(go))
{
return;
}
var animClip = animation[animationName.Value];
if (animClip == null)
{
return;
}
var mixingTransform = go.transform.Find(transfrom.Value);
animClip.AddMixingTransform(mixingTransform);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e312a237c7efd4f41b1cf3391f9aac98
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Rewinds the named animation.")]
public class RewindAnimation : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.Animation)]
public FsmString animName;
public override void Reset()
{
gameObject = null;
animName = null;
}
public override void OnEnter()
{
DoRewindAnimation();
Finish();
}
void DoRewindAnimation()
{
if (string.IsNullOrEmpty(animName.Value))
{
return;
}
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (UpdateCache(go))
{
animation.Rewind(animName.Value);
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: df5af008ae532374aa35afd9bfd06177
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Sets the Speed of an Animation. Check Every Frame to update the animation time continuously, e.g., if you're manipulating a variable that controls animation speed.")]
public class SetAnimationSpeed : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Animation)]
public FsmString animName;
public FsmFloat speed = 1f;
public bool everyFrame;
public override void Reset()
{
gameObject = null;
animName = null;
speed = 1f;
everyFrame = false;
}
public override void OnEnter()
{
DoSetAnimationSpeed(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
DoSetAnimationSpeed(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
}
private void DoSetAnimationSpeed(GameObject go)
{
if (!UpdateCache(go))
{
return;
}
var anim = animation[animName.Value];
if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
return;
}
anim.speed = speed.Value;
}
/*
public override string ErrorCheck()
{
return ErrorCheckHelpers.CheckAnimationSetup(gameObject.value);
}*/
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 791ecdf3435dea248bf2ec0fa7577adf
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Sets the current Time of an Animation, Normalize time means 0 (start) to 1 (end); useful if you don't care about the exact time. Check Every Frame to update the time continuously.")]
public class SetAnimationTime : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Animation)]
public FsmString animName;
public FsmFloat time;
public bool normalized;
public bool everyFrame;
public override void Reset()
{
gameObject = null;
animName = null;
time = null;
normalized = false;
everyFrame = false;
}
public override void OnEnter()
{
DoSetAnimationTime(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
DoSetAnimationTime(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
}
private void DoSetAnimationTime(GameObject go)
{
if (!UpdateCache(go))
{
return;
}
animation.Play(animName.Value);
var anim = animation[animName.Value];
if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
return;
}
if (normalized)
{
anim.normalizedTime = time.Value;
}
else
{
anim.time = time.Value;
}
// TODO: need to do this?
if (everyFrame)
{
anim.speed = 0;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 84994d0c340d30744be8e62b88889675
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Sets the Blend Weight of an Animation. Check Every Frame to update the weight continuously, e.g., if you're manipulating a variable that controls the weight.")]
public class SetAnimationWeight : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
public FsmOwnerDefault gameObject;
[RequiredField]
[UIHint(UIHint.Animation)]
public FsmString animName;
public FsmFloat weight = 1f;
public bool everyFrame;
public override void Reset()
{
gameObject = null;
animName = null;
weight = 1f;
everyFrame = false;
}
public override void OnEnter()
{
DoSetAnimationWeight(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
if (!everyFrame)
{
Finish();
}
}
public override void OnUpdate()
{
DoSetAnimationWeight(gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value);
}
private void DoSetAnimationWeight(GameObject go)
{
if (!UpdateCache(go))
{
return;
}
var anim = animation[animName.Value];
if (anim == null)
{
LogWarning("Missing animation: " + animName.Value);
return;
}
anim.weight = weight.Value;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 2800e1c371ad41e42a66b39fcf5baf43
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("Stops all playing Animations on a Game Object. Optionally, specify a single Animation to Stop.")]
public class StopAnimation : BaseAnimationAction
{
[RequiredField]
[CheckForComponent(typeof(Animation))]
public FsmOwnerDefault gameObject;
[Tooltip("Leave empty to stop all playing animations.")]
[UIHint(UIHint.Animation)]
public FsmString animName;
public override void Reset()
{
gameObject = null;
animName = null;
}
public override void OnEnter()
{
DoStopAnimation();
Finish();
}
private void DoStopAnimation()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (!UpdateCache(go))
{
return;
}
if (FsmString.IsNullOrEmpty(animName))
{
animation.Stop();
}
else
{
animation.Stop(animName.Value);
}
}
/*
public override string ErrorCheck()
{
return ErrorCheckHelpers.CheckAnimationSetup(gameObject.value);
}*/
}
}
\ No newline at end of file
This diff is collapsed.
fileFormatVersion: 2
guid: c848e0fb2719d4319b20db35a1e0393c
folderAsset: yes
DefaultImporter:
userData:
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment