From dcfe0db24ec2e063e60e7671be9c3fa0f6b689a8 Mon Sep 17 00:00:00 2001 From: steven2gleal Date: Tue, 5 Sep 2017 17:37:56 -0500 Subject: [PATCH] experimenting with animator --- Game 1/Assets/Animations/Explosion.anim | 31 ++++-- Game 1/Assets/Animations/Explosion.anim.meta | 2 +- Game 1/Assets/Animations/Explosion.controller | 60 +++++++++- .../Animations/Explosion.controller.meta | 4 +- Game 1/Assets/Levels/Level 0.unity | 103 +++++++++++++++++- .../Scripts/AnimationEventFunctions.meta | 9 ++ .../DeleteOnComplete.cs | 11 ++ .../DeleteOnComplete.cs.meta | 12 ++ Game 1/Assets/Scripts/Explosion.cs | 8 +- Game 1/Assets/Scripts/PlayerController.cs | 5 +- Game 1/Assets/Sprites.meta | 9 ++ 11 files changed, 227 insertions(+), 27 deletions(-) create mode 100644 Game 1/Assets/Scripts/AnimationEventFunctions.meta create mode 100644 Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs create mode 100644 Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs.meta create mode 100644 Game 1/Assets/Sprites.meta diff --git a/Game 1/Assets/Animations/Explosion.anim b/Game 1/Assets/Animations/Explosion.anim index 4727544..6463fb5 100644 --- a/Game 1/Assets/Animations/Explosion.anim +++ b/Game 1/Assets/Animations/Explosion.anim @@ -20,27 +20,27 @@ AnimationClip: - curve: - time: 0 value: {fileID: 21300000, guid: 881bd5958f68ce247b9a4f5efecbb941, type: 3} - - time: 0.1 + - time: 0.083333336 value: {fileID: 21300000, guid: d3a8897c2d6f8ce448f3ad959a265f74, type: 3} - - time: 0.2 + - time: 0.16666667 value: {fileID: 21300000, guid: a3ab2886f68aaeb45b9389f4cfac0552, type: 3} - - time: 0.3 + - time: 0.25 value: {fileID: 21300000, guid: 216dcb0bcaca0ca41a80571977743aa4, type: 3} - - time: 0.4 + - time: 0.33333334 value: {fileID: 21300000, guid: c447e916fd09fa64a9434fd8eb266c1f, type: 3} - - time: 0.5 + - time: 0.41666666 value: {fileID: 21300000, guid: 84c5fa4b9faddba478c05f6efa1caa97, type: 3} - - time: 0.6 + - time: 0.5 value: {fileID: 21300000, guid: 44c161753e16f9c42b4b66366d3bc056, type: 3} - - time: 0.7 + - time: 0.5833333 value: {fileID: 21300000, guid: cf25e726d7293e5408e59948fdf21884, type: 3} - - time: 0.8 + - time: 0.6666667 value: {fileID: 21300000, guid: 9583288c1726a0446b0e9d3f30047cbc, type: 3} attribute: m_Sprite path: classID: 212 script: {fileID: 0} - m_SampleRate: 10 + m_SampleRate: 12 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} @@ -69,12 +69,12 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.90000004 + m_StopTime: 0.75 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 m_HasAdditiveReferencePose: 0 - m_LoopTime: 1 + m_LoopTime: 0 m_LoopBlend: 0 m_LoopBlendOrientation: 0 m_LoopBlendPositionY: 0 @@ -89,4 +89,11 @@ AnimationClip: m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 m_GenerateMotionCurves: 0 - m_Events: [] + m_Events: + - time: 0.75 + functionName: + data: + objectReferenceParameter: {fileID: 0} + floatParameter: 0 + intParameter: 0 + messageOptions: 0 diff --git a/Game 1/Assets/Animations/Explosion.anim.meta b/Game 1/Assets/Animations/Explosion.anim.meta index a79ecb3..cfdac5b 100644 --- a/Game 1/Assets/Animations/Explosion.anim.meta +++ b/Game 1/Assets/Animations/Explosion.anim.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: d33da4890b8c06245acb5521780c04e7 -timeCreated: 1504560403 +timeCreated: 1504642671 licenseType: Free NativeFormatImporter: mainObjectFileID: 7400000 diff --git a/Game 1/Assets/Animations/Explosion.controller b/Game 1/Assets/Animations/Explosion.controller index 33834e6..fb35adb 100644 --- a/Game 1/Assets/Animations/Explosion.controller +++ b/Game 1/Assets/Animations/Explosion.controller @@ -11,7 +11,7 @@ AnimatorController: m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer - m_StateMachine: {fileID: 1107124966039000128} + m_StateMachine: {fileID: 1107450737580238592} m_Mask: {fileID: 0} m_Motions: [] m_Behaviours: [] @@ -21,7 +21,28 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} ---- !u!1102 &1102155469024640798 +--- !u!1101 &1101774425169895672 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102864613521452634} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.6666666 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &1102044952823616290 AnimatorState: serializedVersion: 5 m_ObjectHideFlags: 1 @@ -30,6 +51,30 @@ AnimatorState: m_Name: Explosion m_Speed: 1 m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101774425169895672} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: d33da4890b8c06245acb5521780c04e7, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1102 &1102864613521452634 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Done + m_Speed: 0 + m_CycleOffset: 0 m_Transitions: [] m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} @@ -44,7 +89,7 @@ AnimatorState: m_SpeedParameter: m_MirrorParameter: m_CycleOffsetParameter: ---- !u!1107 &1107124966039000128 +--- !u!1107 &1107450737580238592 AnimatorStateMachine: serializedVersion: 5 m_ObjectHideFlags: 1 @@ -53,8 +98,11 @@ AnimatorStateMachine: m_Name: Base Layer m_ChildStates: - serializedVersion: 1 - m_State: {fileID: 1102155469024640798} - m_Position: {x: 200, y: 0, z: 0} + m_State: {fileID: 1102044952823616290} + m_Position: {x: 300, y: 108, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102864613521452634} + m_Position: {x: 552, y: 108, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] @@ -64,4 +112,4 @@ AnimatorStateMachine: m_EntryPosition: {x: 50, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} - m_DefaultState: {fileID: 1102155469024640798} + m_DefaultState: {fileID: 1102044952823616290} diff --git a/Game 1/Assets/Animations/Explosion.controller.meta b/Game 1/Assets/Animations/Explosion.controller.meta index c89962a..2da98d5 100644 --- a/Game 1/Assets/Animations/Explosion.controller.meta +++ b/Game 1/Assets/Animations/Explosion.controller.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 546e5e4795abb4a4c8fe0394df79437d -timeCreated: 1504560404 +guid: 199880b47555b8643a17c2000501e0ea +timeCreated: 1504642671 licenseType: Free NativeFormatImporter: mainObjectFileID: 9100000 diff --git a/Game 1/Assets/Levels/Level 0.unity b/Game 1/Assets/Levels/Level 0.unity index 908070f..95b2195 100644 --- a/Game 1/Assets/Levels/Level 0.unity +++ b/Game 1/Assets/Levels/Level 0.unity @@ -11081,7 +11081,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: jumpPower: 15 - explosion: {fileID: 7400000, guid: d33da4890b8c06245acb5521780c04e7, type: 2} + explosion: {fileID: 0} --- !u!212 &440329286 SpriteRenderer: m_ObjectHideFlags: 0 @@ -23019,6 +23019,107 @@ SpriteRenderer: m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 +--- !u!1 &938413873 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 938413876} + - component: {fileID: 938413875} + - component: {fileID: 938413874} + - component: {fileID: 938413877} + m_Layer: 0 + m_Name: regularExplosion00 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!95 &938413874 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 938413873} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 199880b47555b8643a17c2000501e0ea, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 +--- !u!212 &938413875 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 938413873} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 881bd5958f68ce247b9a4f5efecbb941, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 +--- !u!4 &938413876 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 938413873} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -3.930605, y: 1.2588631, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &938413877 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 938413873} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 93cb9d08b2b4f164d95fa992385774e9, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &945286658 GameObject: m_ObjectHideFlags: 0 diff --git a/Game 1/Assets/Scripts/AnimationEventFunctions.meta b/Game 1/Assets/Scripts/AnimationEventFunctions.meta new file mode 100644 index 0000000..f167a9a --- /dev/null +++ b/Game 1/Assets/Scripts/AnimationEventFunctions.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6972a0bb549a27a4a9b11f69d15a5119 +folderAsset: yes +timeCreated: 1504644409 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs b/Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs new file mode 100644 index 0000000..aa6fc8a --- /dev/null +++ b/Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs @@ -0,0 +1,11 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DeleteOnComplete : MonoBehaviour { + + public DeleteOnComplete() + { + + } +} diff --git a/Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs.meta b/Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs.meta new file mode 100644 index 0000000..a6d09fd --- /dev/null +++ b/Game 1/Assets/Scripts/AnimationEventFunctions/DeleteOnComplete.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 62c625961f56be543920756f3b84d197 +timeCreated: 1504644420 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Game 1/Assets/Scripts/Explosion.cs b/Game 1/Assets/Scripts/Explosion.cs index c7047df..8d745c7 100644 --- a/Game 1/Assets/Scripts/Explosion.cs +++ b/Game 1/Assets/Scripts/Explosion.cs @@ -4,13 +4,17 @@ using UnityEngine; public class Explosion : MonoBehaviour { + private Animator anim; + // Use this for initialization void Start () { - + anim = GetComponent(); } // Update is called once per frame void Update () { - + Debug.Log(anim.GetCurrentAnimatorStateInfo(0).tagHash); + //if (anim.GetCurrentAnimatorStateInfo(0).tagHash == 0) + // Destroy(gameObject); } } diff --git a/Game 1/Assets/Scripts/PlayerController.cs b/Game 1/Assets/Scripts/PlayerController.cs index b874572..30faebd 100644 --- a/Game 1/Assets/Scripts/PlayerController.cs +++ b/Game 1/Assets/Scripts/PlayerController.cs @@ -12,7 +12,7 @@ public class PlayerController : MonoBehaviour { // Use this for initialization void Start () { - explode = (AnimationClip)Instantiate(explosion, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity); + // explode = (AnimationClip)Instantiate(explosion, Camera.main.ScreenToWorldPoint(Input.mousePosition), Quaternion.identity); } // Update is called once per frame @@ -25,8 +25,7 @@ public class PlayerController : MonoBehaviour { if (Input.GetMouseButtonDown(0)) { - //explode.Play; - Debug.Log("Explosion at: " + Input.mousePosition); + } } diff --git a/Game 1/Assets/Sprites.meta b/Game 1/Assets/Sprites.meta new file mode 100644 index 0000000..3eeaedb --- /dev/null +++ b/Game 1/Assets/Sprites.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1884be5a55d87e54689bff928b40ee6d +folderAsset: yes +timeCreated: 1504642159 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: