mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[unity] Updated some example scenes, code and assets.
This commit is contained in:
parent
4c45413dff
commit
0aa617c44a
@ -136,7 +136,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1381317420}
|
m_Father: {fileID: 1381317420}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!102 &16304518
|
--- !u!102 &16304518
|
||||||
TextMesh:
|
TextMesh:
|
||||||
@ -685,111 +685,12 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 380101352}
|
m_GameObject: {fileID: 380101352}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0.28119996, y: 0.002599962, z: 0}
|
m_LocalPosition: {x: 0.28119996, y: 0.002600003, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 985424158}
|
m_Father: {fileID: 985424158}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &417291116
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
serializedVersion: 5
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 417291117}
|
|
||||||
- component: {fileID: 417291119}
|
|
||||||
- component: {fileID: 417291118}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Description
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &417291117
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 417291116}
|
|
||||||
m_LocalRotation: {x: 0.0012827545, y: 0.104989655, z: -0.012149473, w: -0.9943983}
|
|
||||||
m_LocalPosition: {x: -8.1, y: 9.2, z: 0.5}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 1381317420}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!102 &417291118
|
|
||||||
TextMesh:
|
|
||||||
serializedVersion: 3
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 417291116}
|
|
||||||
m_Text: 'Hero''s Basic Platformer Controller setup has
|
|
||||||
|
|
||||||
Input, View and Logic condensed into one script.
|
|
||||||
|
|
||||||
|
|
||||||
The use pattern is built around using the built-in
|
|
||||||
|
|
||||||
UnityEngine Character Controller component.
|
|
||||||
|
|
||||||
|
|
||||||
This is a quick way to get things working and a
|
|
||||||
|
|
||||||
good place to start if you''re new to platforming.
|
|
||||||
|
|
||||||
But you can always build your own platformer character
|
|
||||||
|
|
||||||
controller if you want better control of the physics code.'
|
|
||||||
m_OffsetZ: 0
|
|
||||||
m_CharacterSize: 0.12
|
|
||||||
m_LineSpacing: 1
|
|
||||||
m_Anchor: 0
|
|
||||||
m_Alignment: 0
|
|
||||||
m_TabSize: 4
|
|
||||||
m_FontSize: 24
|
|
||||||
m_FontStyle: 0
|
|
||||||
m_RichText: 1
|
|
||||||
m_Font: {fileID: 0}
|
|
||||||
m_Color:
|
|
||||||
serializedVersion: 2
|
|
||||||
rgba: 4294967295
|
|
||||||
--- !u!23 &417291119
|
|
||||||
MeshRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 417291116}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 0
|
|
||||||
m_ReflectionProbeUsage: 0
|
|
||||||
m_Materials:
|
|
||||||
- {fileID: 10100, guid: 0000000000000000e000000000000000, 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: 3
|
|
||||||
m_MinimumChartSize: 4
|
|
||||||
m_AutoUVMaxDistance: 0.5
|
|
||||||
m_AutoUVMaxAngle: 89
|
|
||||||
m_LightmapParameters: {fileID: 0}
|
|
||||||
m_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 0
|
|
||||||
--- !u!1 &443343503
|
--- !u!1 &443343503
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -960,7 +861,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1381317420}
|
m_Father: {fileID: 1381317420}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!102 &522034804
|
--- !u!102 &522034804
|
||||||
TextMesh:
|
TextMesh:
|
||||||
@ -1403,7 +1304,6 @@ MonoBehaviour:
|
|||||||
singleSubmesh: 0
|
singleSubmesh: 0
|
||||||
addNormals: 0
|
addNormals: 0
|
||||||
calculateTangents: 0
|
calculateTangents: 0
|
||||||
logErrors: 0
|
|
||||||
disableRenderingOnOverride: 1
|
disableRenderingOnOverride: 1
|
||||||
_animationName: Idle
|
_animationName: Idle
|
||||||
loop: 1
|
loop: 1
|
||||||
@ -1929,7 +1829,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1018673310}
|
m_GameObject: {fileID: 1018673310}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -0.3129, y: 0.002599962, z: 0}
|
m_LocalPosition: {x: -0.3129, y: 0.002600003, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 985424158}
|
m_Father: {fileID: 985424158}
|
||||||
@ -2517,7 +2417,7 @@ ParticleSystem:
|
|||||||
moveWithTransform: 1
|
moveWithTransform: 1
|
||||||
moveWithCustomTransform: {fileID: 0}
|
moveWithCustomTransform: {fileID: 0}
|
||||||
scalingMode: 1
|
scalingMode: 1
|
||||||
randomSeed: -545095057
|
randomSeed: 485128221
|
||||||
InitialModule:
|
InitialModule:
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
enabled: 1
|
enabled: 1
|
||||||
@ -5537,6 +5437,7 @@ GameObject:
|
|||||||
- component: {fileID: 1204355833}
|
- component: {fileID: 1204355833}
|
||||||
- component: {fileID: 1204355834}
|
- component: {fileID: 1204355834}
|
||||||
- component: {fileID: 1204355835}
|
- component: {fileID: 1204355835}
|
||||||
|
- component: {fileID: 1204355836}
|
||||||
m_Layer: 9
|
m_Layer: 9
|
||||||
m_Name: Player
|
m_Name: Player
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -5587,6 +5488,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 27b3e3370f55c0a438ef0a10c2eba510, type: 3}
|
m_Script: {fileID: 11500000, guid: 27b3e3370f55c0a438ef0a10c2eba510, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
controller: {fileID: 1204355832}
|
||||||
XAxis: Horizontal
|
XAxis: Horizontal
|
||||||
YAxis: Vertical
|
YAxis: Vertical
|
||||||
JumpButton: Jump
|
JumpButton: Jump
|
||||||
@ -5598,19 +5500,22 @@ MonoBehaviour:
|
|||||||
jumpInterruptFactor: 0.5
|
jumpInterruptFactor: 0.5
|
||||||
forceCrouchVelocity: 30
|
forceCrouchVelocity: 30
|
||||||
forceCrouchDuration: 0.4
|
forceCrouchDuration: 0.4
|
||||||
skeletonAnimation: {fileID: 658011011}
|
animationHandle: {fileID: 1204355835}
|
||||||
transitions: {fileID: 1204355835}
|
OnJump:
|
||||||
walk: {fileID: 11400000, guid: 096b05b71bb32cb409c1c8fd233b7ac3, type: 2}
|
m_PersistentCalls:
|
||||||
run: {fileID: 11400000, guid: cc83238c61de380499565292bef7ada4, type: 2}
|
m_Calls: []
|
||||||
idle: {fileID: 11400000, guid: 8e32f0310bb5c02488c5c002dd41e7cb, type: 2}
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
jump: {fileID: 11400000, guid: 9fc9ad17b39175242a17dedc100251e5, type: 2}
|
PublicKeyToken=null
|
||||||
fall: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
OnLand:
|
||||||
crouch: {fileID: 11400000, guid: 25961ff211f6f3947be85f8aab3f2630, type: 2}
|
m_PersistentCalls:
|
||||||
runFromFall: {fileID: 11400000, guid: fcca5e996ae24ba43baaaadef1fb6ad9, type: 2}
|
m_Calls: []
|
||||||
jumpAudioSource: {fileID: 1845666709}
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
hardfallAudioSource: {fileID: 443343505}
|
PublicKeyToken=null
|
||||||
landParticles: {fileID: 1189703950}
|
OnHardLand:
|
||||||
footstepHandler: {fileID: 1204355834}
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
|
PublicKeyToken=null
|
||||||
--- !u!114 &1204355834
|
--- !u!114 &1204355834
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -5637,19 +5542,117 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 1204355830}
|
m_GameObject: {fileID: 1204355830}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: 69a52bf79b7e78e4cb1dfd2d2e698c2d, type: 3}
|
m_Script: {fileID: 11500000, guid: dd8d49de34fd0724ca8c1ae3c44afe59, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
skeletonAnimation: {fileID: 658011011}
|
||||||
|
statesAndAnimations:
|
||||||
|
- stateName: walk
|
||||||
|
animation: {fileID: 11400000, guid: 096b05b71bb32cb409c1c8fd233b7ac3, type: 2}
|
||||||
|
- stateName: run
|
||||||
|
animation: {fileID: 11400000, guid: cc83238c61de380499565292bef7ada4, type: 2}
|
||||||
|
- stateName: idle
|
||||||
|
animation: {fileID: 11400000, guid: 8e32f0310bb5c02488c5c002dd41e7cb, type: 2}
|
||||||
|
- stateName: crouch
|
||||||
|
animation: {fileID: 11400000, guid: 25961ff211f6f3947be85f8aab3f2630, type: 2}
|
||||||
|
- stateName: rise
|
||||||
|
animation: {fileID: 11400000, guid: 9fc9ad17b39175242a17dedc100251e5, type: 2}
|
||||||
|
- stateName: fall
|
||||||
|
animation: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
||||||
|
- stateName: attack
|
||||||
|
animation: {fileID: 11400000, guid: a7f08ab57415c7548a57933fe9332cf0, type: 2}
|
||||||
transitions:
|
transitions:
|
||||||
|
- from: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
||||||
|
to: {fileID: 11400000, guid: 25961ff211f6f3947be85f8aab3f2630, type: 2}
|
||||||
|
transition: {fileID: 11400000, guid: 6c587772a6f7df94b934b353291c008c, type: 2}
|
||||||
- from: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
- from: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
||||||
to: {fileID: 11400000, guid: cc83238c61de380499565292bef7ada4, type: 2}
|
to: {fileID: 11400000, guid: cc83238c61de380499565292bef7ada4, type: 2}
|
||||||
transition: {fileID: 11400000, guid: fcca5e996ae24ba43baaaadef1fb6ad9, type: 2}
|
transition: {fileID: 11400000, guid: fcca5e996ae24ba43baaaadef1fb6ad9, type: 2}
|
||||||
- from: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
- from: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
||||||
to: {fileID: 11400000, guid: 8e32f0310bb5c02488c5c002dd41e7cb, type: 2}
|
to: {fileID: 11400000, guid: 8e32f0310bb5c02488c5c002dd41e7cb, type: 2}
|
||||||
transition: {fileID: 11400000, guid: 714e39dce7285c145bdf142c38ef9a9b, type: 2}
|
transition: {fileID: 11400000, guid: 714e39dce7285c145bdf142c38ef9a9b, type: 2}
|
||||||
- from: {fileID: 11400000, guid: 29c1381a00cfb2c4d996f2a02fcc4506, type: 2}
|
--- !u!114 &1204355836
|
||||||
to: {fileID: 11400000, guid: 25961ff211f6f3947be85f8aab3f2630, type: 2}
|
MonoBehaviour:
|
||||||
transition: {fileID: 11400000, guid: 6c587772a6f7df94b934b353291c008c, type: 2}
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1204355830}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8a0f8a82c5d8a334db6996478778b892, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
eventSource: {fileID: 1204355833}
|
||||||
|
OnJump:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1204355834}
|
||||||
|
m_MethodName: Play
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
|
PublicKeyToken=null
|
||||||
|
OnLand:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1204355834}
|
||||||
|
m_MethodName: Play
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
- m_Target: {fileID: 1189703950}
|
||||||
|
m_MethodName: Emit
|
||||||
|
m_Mode: 3
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 4
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
|
PublicKeyToken=null
|
||||||
|
OnHardLand:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 443343505}
|
||||||
|
m_MethodName: Play
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
- m_Target: {fileID: 1189703950}
|
||||||
|
m_MethodName: Emit
|
||||||
|
m_Mode: 3
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 10
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine, Version=0.0.0.0, Culture=neutral,
|
||||||
|
PublicKeyToken=null
|
||||||
--- !u!1 &1217440894
|
--- !u!1 &1217440894
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -5876,7 +5879,6 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 417291117}
|
|
||||||
- {fileID: 16304517}
|
- {fileID: 16304517}
|
||||||
- {fileID: 522034803}
|
- {fileID: 522034803}
|
||||||
- {fileID: 1512255394}
|
- {fileID: 1512255394}
|
||||||
@ -6100,7 +6102,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1381317420}
|
m_Father: {fileID: 1381317420}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!102 &1512255395
|
--- !u!102 &1512255395
|
||||||
TextMesh:
|
TextMesh:
|
||||||
@ -6427,7 +6429,7 @@ Transform:
|
|||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1621947180}
|
m_GameObject: {fileID: 1621947180}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: -0.08151186, z: 0}
|
m_LocalPosition: {x: 0, y: -0.05, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 658011009}
|
- {fileID: 658011009}
|
||||||
|
|||||||
@ -108,39 +108,6 @@ NavMeshSettings:
|
|||||||
tileSize: 256
|
tileSize: 256
|
||||||
accuratePlacement: 0
|
accuratePlacement: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
--- !u!21 &185304931
|
|
||||||
Material:
|
|
||||||
serializedVersion: 6
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_Name: whirlyblendmodes_Material SkeletonPMAScreen
|
|
||||||
m_Shader: {fileID: 4800000, guid: 4e8caa36c07aacf4ab270da00784e4d9, type: 3}
|
|
||||||
m_ShaderKeywords:
|
|
||||||
m_LightmapFlags: 4
|
|
||||||
m_EnableInstancingVariants: 0
|
|
||||||
m_DoubleSidedGI: 0
|
|
||||||
m_CustomRenderQueue: -1
|
|
||||||
stringTagMap: {}
|
|
||||||
disabledShaderPasses: []
|
|
||||||
m_SavedProperties:
|
|
||||||
serializedVersion: 3
|
|
||||||
m_TexEnvs:
|
|
||||||
- <noninit>:
|
|
||||||
m_Texture: {fileID: 0}
|
|
||||||
m_Scale: {x: 1, y: 1}
|
|
||||||
m_Offset: {x: 0, y: 0}
|
|
||||||
- _MainTex:
|
|
||||||
m_Texture: {fileID: 2800000, guid: dc1b9f9665c8aa74799404a1d2038e3d, type: 3}
|
|
||||||
m_Scale: {x: 1, y: 1}
|
|
||||||
m_Offset: {x: 0, y: 0}
|
|
||||||
m_Floats:
|
|
||||||
- <noninit>: 0
|
|
||||||
- _Cutoff: 0.1
|
|
||||||
- _StraightAlphaInput: 0
|
|
||||||
m_Colors:
|
|
||||||
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007121922}
|
|
||||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
--- !u!1 &200188759
|
--- !u!1 &200188759
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -241,6 +208,7 @@ GameObject:
|
|||||||
- component: {fileID: 267173957}
|
- component: {fileID: 267173957}
|
||||||
- component: {fileID: 267173956}
|
- component: {fileID: 267173956}
|
||||||
- component: {fileID: 267173955}
|
- component: {fileID: 267173955}
|
||||||
|
- component: {fileID: 267173959}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Spine GameObject (spineboy-pro)
|
m_Name: Spine GameObject (spineboy-pro)
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -284,7 +252,7 @@ MeshRenderer:
|
|||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 267173954}
|
m_GameObject: {fileID: 267173954}
|
||||||
m_Enabled: 1
|
m_Enabled: 0
|
||||||
m_CastShadows: 0
|
m_CastShadows: 0
|
||||||
m_ReceiveShadows: 0
|
m_ReceiveShadows: 0
|
||||||
m_MotionVectors: 1
|
m_MotionVectors: 1
|
||||||
@ -334,7 +302,24 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!21 &1280556233
|
--- !u!114 &267173959
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 267173954}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5c70a5b35f6ff2541aed8e8346b7e4d5, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
skeletonRenderer: {fileID: 267173955}
|
||||||
|
copyPropertyBlock: 1
|
||||||
|
copyMeshRendererFlags: 1
|
||||||
|
partsRenderers:
|
||||||
|
- {fileID: 1776944552}
|
||||||
|
- {fileID: 1476882952}
|
||||||
|
--- !u!21 &522217957
|
||||||
Material:
|
Material:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -558,8 +543,8 @@ MeshRenderer:
|
|||||||
m_ReflectionProbeUsage: 0
|
m_ReflectionProbeUsage: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: e162c08da1abc294cb851248f51dfc40, type: 2}
|
- {fileID: 2100000, guid: e162c08da1abc294cb851248f51dfc40, type: 2}
|
||||||
- {fileID: 1280556233}
|
- {fileID: 522217957}
|
||||||
- {fileID: 185304931}
|
- {fileID: 2036777000}
|
||||||
- {fileID: 2100000, guid: e162c08da1abc294cb851248f51dfc40, type: 2}
|
- {fileID: 2100000, guid: e162c08da1abc294cb851248f51dfc40, type: 2}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
@ -690,3 +675,36 @@ Transform:
|
|||||||
m_Father: {fileID: 267173958}
|
m_Father: {fileID: 267173958}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!21 &2036777000
|
||||||
|
Material:
|
||||||
|
serializedVersion: 6
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_PrefabParentObject: {fileID: 0}
|
||||||
|
m_PrefabInternal: {fileID: 0}
|
||||||
|
m_Name: whirlyblendmodes_Material SkeletonPMAScreen
|
||||||
|
m_Shader: {fileID: 4800000, guid: 4e8caa36c07aacf4ab270da00784e4d9, type: 3}
|
||||||
|
m_ShaderKeywords:
|
||||||
|
m_LightmapFlags: 4
|
||||||
|
m_EnableInstancingVariants: 0
|
||||||
|
m_DoubleSidedGI: 0
|
||||||
|
m_CustomRenderQueue: -1
|
||||||
|
stringTagMap: {}
|
||||||
|
disabledShaderPasses: []
|
||||||
|
m_SavedProperties:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TexEnvs:
|
||||||
|
- <noninit>:
|
||||||
|
m_Texture: {fileID: 0}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
- _MainTex:
|
||||||
|
m_Texture: {fileID: 2800000, guid: dc1b9f9665c8aa74799404a1d2038e3d, type: 3}
|
||||||
|
m_Scale: {x: 1, y: 1}
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
m_Floats:
|
||||||
|
- <noninit>: 0
|
||||||
|
- _Cutoff: 0.1
|
||||||
|
- _StraightAlphaInput: 0
|
||||||
|
m_Colors:
|
||||||
|
- <noninit>: {r: 0, g: 2.018574, b: 1e-45, a: 0.000007121922}
|
||||||
|
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
using Spine.Unity;
|
using Spine.Unity;
|
||||||
|
|
||||||
namespace Spine.Unity.Examples {
|
namespace Spine.Unity.Examples {
|
||||||
@ -36,6 +37,20 @@ namespace Spine.Unity.Examples {
|
|||||||
[RequireComponent(typeof(CharacterController))]
|
[RequireComponent(typeof(CharacterController))]
|
||||||
public class BasicPlatformerController : MonoBehaviour {
|
public class BasicPlatformerController : MonoBehaviour {
|
||||||
|
|
||||||
|
public enum CharacterState {
|
||||||
|
None,
|
||||||
|
Idle,
|
||||||
|
Walk,
|
||||||
|
Run,
|
||||||
|
Crouch,
|
||||||
|
Rise,
|
||||||
|
Fall,
|
||||||
|
Attack
|
||||||
|
}
|
||||||
|
|
||||||
|
[Header("Components")]
|
||||||
|
public CharacterController controller;
|
||||||
|
|
||||||
[Header("Controls")]
|
[Header("Controls")]
|
||||||
public string XAxis = "Horizontal";
|
public string XAxis = "Horizontal";
|
||||||
public string YAxis = "Vertical";
|
public string YAxis = "Vertical";
|
||||||
@ -53,38 +68,19 @@ namespace Spine.Unity.Examples {
|
|||||||
public float forceCrouchVelocity = 25;
|
public float forceCrouchVelocity = 25;
|
||||||
public float forceCrouchDuration = 0.5f;
|
public float forceCrouchDuration = 0.5f;
|
||||||
|
|
||||||
[Header("Visuals")]
|
|
||||||
public SkeletonAnimation skeletonAnimation;
|
|
||||||
|
|
||||||
[Header("Animation")]
|
[Header("Animation")]
|
||||||
public TransitionDictionaryExample transitions;
|
public SkeletonAnimationHandleExample animationHandle;
|
||||||
public AnimationReferenceAsset walk;
|
|
||||||
public AnimationReferenceAsset run;
|
|
||||||
public AnimationReferenceAsset idle;
|
|
||||||
public AnimationReferenceAsset jump;
|
|
||||||
public AnimationReferenceAsset fall;
|
|
||||||
public AnimationReferenceAsset crouch;
|
|
||||||
public AnimationReferenceAsset runFromFall;
|
|
||||||
|
|
||||||
[Header("Effects")]
|
// Events
|
||||||
public AudioSource jumpAudioSource;
|
public event UnityAction OnJump, OnLand, OnHardLand;
|
||||||
public AudioSource hardfallAudioSource;
|
|
||||||
public ParticleSystem landParticles;
|
|
||||||
public HandleEventWithAudioExample footstepHandler;
|
|
||||||
|
|
||||||
CharacterController controller;
|
|
||||||
Vector2 input = default(Vector2);
|
Vector2 input = default(Vector2);
|
||||||
Vector3 velocity = default(Vector3);
|
Vector3 velocity = default(Vector3);
|
||||||
float minimumJumpEndTime = 0;
|
float minimumJumpEndTime = 0;
|
||||||
float forceCrouchEndTime;
|
float forceCrouchEndTime;
|
||||||
bool wasGrounded = false;
|
bool wasGrounded = false;
|
||||||
|
|
||||||
AnimationReferenceAsset targetAnimation;
|
CharacterState previousState, currentState;
|
||||||
AnimationReferenceAsset previousTargetAnimation;
|
|
||||||
|
|
||||||
void Awake () {
|
|
||||||
controller = GetComponent<CharacterController>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update () {
|
void Update () {
|
||||||
float dt = Time.deltaTime;
|
float dt = Time.deltaTime;
|
||||||
@ -122,7 +118,6 @@ namespace Spine.Unity.Examples {
|
|||||||
// Dummy physics and controller using UnityEngine.CharacterController.
|
// Dummy physics and controller using UnityEngine.CharacterController.
|
||||||
Vector3 gravityDeltaVelocity = Physics.gravity * gravityScale * dt;
|
Vector3 gravityDeltaVelocity = Physics.gravity * gravityScale * dt;
|
||||||
|
|
||||||
|
|
||||||
if (doJump) {
|
if (doJump) {
|
||||||
velocity.y = jumpSpeed;
|
velocity.y = jumpSpeed;
|
||||||
minimumJumpEndTime = Time.time + minimumJumpDuration;
|
minimumJumpEndTime = Time.time + minimumJumpDuration;
|
||||||
@ -149,60 +144,77 @@ namespace Spine.Unity.Examples {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
controller.Move(velocity * dt);
|
controller.Move(velocity * dt);
|
||||||
|
wasGrounded = isGrounded;
|
||||||
|
|
||||||
// Animation
|
// Determine and store character state
|
||||||
// Determine target animation.
|
|
||||||
if (isGrounded) {
|
if (isGrounded) {
|
||||||
if (doCrouch) {
|
if (doCrouch) {
|
||||||
targetAnimation = crouch;
|
currentState = CharacterState.Crouch;
|
||||||
} else {
|
} else {
|
||||||
if (input.x == 0)
|
if (input.x == 0)
|
||||||
targetAnimation = idle;
|
currentState = CharacterState.Idle;
|
||||||
else
|
else
|
||||||
targetAnimation = Mathf.Abs(input.x) > 0.6f ? run : walk;
|
currentState = Mathf.Abs(input.x) > 0.6f ? CharacterState.Run : CharacterState.Walk;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
targetAnimation = velocity.y > 0 ? jump : fall;
|
currentState = velocity.y > 0 ? CharacterState.Rise : CharacterState.Fall;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle change in target animation.
|
bool stateChanged = previousState != currentState;
|
||||||
if (previousTargetAnimation != targetAnimation) {
|
previousState = currentState;
|
||||||
Animation transition = null;
|
|
||||||
if (transitions != null && previousTargetAnimation != null) {
|
|
||||||
transition = transitions.GetTransition(previousTargetAnimation, targetAnimation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transition != null) {
|
// Animation
|
||||||
skeletonAnimation.AnimationState.SetAnimation(0, transition, false).MixDuration = 0.05f;
|
// Do not modify character parameters or state in this phase. Just read them.
|
||||||
skeletonAnimation.AnimationState.AddAnimation(0, targetAnimation, true, 0f);
|
// Detect changes in state, and communicate with animation handle if it changes.
|
||||||
} else {
|
if (stateChanged)
|
||||||
skeletonAnimation.AnimationState.SetAnimation(0, targetAnimation, true);
|
HandleStateChanged();
|
||||||
}
|
|
||||||
}
|
|
||||||
previousTargetAnimation = targetAnimation;
|
|
||||||
|
|
||||||
// Face intended direction.
|
|
||||||
if (input.x != 0)
|
if (input.x != 0)
|
||||||
skeletonAnimation.Skeleton.ScaleX = Mathf.Sign(input.x);
|
animationHandle.SetFlip(input.x);
|
||||||
|
|
||||||
|
// Fire events.
|
||||||
// Effects
|
|
||||||
if (doJump) {
|
if (doJump) {
|
||||||
jumpAudioSource.Stop();
|
OnJump.Invoke();
|
||||||
jumpAudioSource.Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (landed) {
|
if (landed) {
|
||||||
if (hardLand) {
|
if (hardLand) {
|
||||||
hardfallAudioSource.Play();
|
OnHardLand.Invoke();
|
||||||
} else {
|
} else {
|
||||||
footstepHandler.Play();
|
OnLand.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
landParticles.Emit((int)(velocity.y / -9f) + 2);
|
void HandleStateChanged () {
|
||||||
|
// When the state changes, notify the animation handle of the new state.
|
||||||
|
string stateName = null;
|
||||||
|
switch (currentState) {
|
||||||
|
case CharacterState.Idle:
|
||||||
|
stateName = "idle";
|
||||||
|
break;
|
||||||
|
case CharacterState.Walk:
|
||||||
|
stateName = "walk";
|
||||||
|
break;
|
||||||
|
case CharacterState.Run:
|
||||||
|
stateName = "run";
|
||||||
|
break;
|
||||||
|
case CharacterState.Crouch:
|
||||||
|
stateName = "crouch";
|
||||||
|
break;
|
||||||
|
case CharacterState.Rise:
|
||||||
|
stateName = "rise";
|
||||||
|
break;
|
||||||
|
case CharacterState.Fall:
|
||||||
|
stateName = "fall";
|
||||||
|
break;
|
||||||
|
case CharacterState.Attack:
|
||||||
|
stateName = "attack";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
wasGrounded = isGrounded;
|
animationHandle.PlayAnimationForState(stateName, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes Software License v2.5
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2016, Esoteric Software
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||||
|
* non-transferable license to use, install, execute, and perform the Spine
|
||||||
|
* Runtimes software and derivative works solely for personal or internal
|
||||||
|
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||||
|
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||||
|
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||||
|
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||||
|
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||||
|
* or other intellectual property or proprietary rights notices on or in the
|
||||||
|
* Software, including any copy thereof. Redistributions in binary or source
|
||||||
|
* form must include this license and terms.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||||
|
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Examples {
|
||||||
|
public class HeroEffectsHandlerExample : MonoBehaviour {
|
||||||
|
public BasicPlatformerController eventSource;
|
||||||
|
public UnityEvent OnJump, OnLand, OnHardLand;
|
||||||
|
|
||||||
|
public void Awake () {
|
||||||
|
if (eventSource == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
eventSource.OnLand += OnLand.Invoke;
|
||||||
|
eventSource.OnJump += OnJump.Invoke;
|
||||||
|
eventSource.OnHardLand += OnHardLand.Invoke;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8a0f8a82c5d8a334db6996478778b892
|
||||||
|
timeCreated: 1545916292
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,14 +1,47 @@
|
|||||||
using System.Collections;
|
/******************************************************************************
|
||||||
using System.Collections.Generic;
|
* Spine Runtimes Software License v2.5
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2016, Esoteric Software
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||||
|
* non-transferable license to use, install, execute, and perform the Spine
|
||||||
|
* Runtimes software and derivative works solely for personal or internal
|
||||||
|
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||||
|
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||||
|
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||||
|
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||||
|
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||||
|
* or other intellectual property or proprietary rights notices on or in the
|
||||||
|
* Software, including any copy thereof. Redistributions in binary or source
|
||||||
|
* form must include this license and terms.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
|
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||||
|
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
|
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
namespace Spine.Unity.Examples {
|
namespace Spine.Unity.Examples {
|
||||||
public class SkeletonAnimationHandleExample : MonoBehaviour {
|
|
||||||
|
|
||||||
|
// This is an example of an animation handle. This is implemented with strings as state names.
|
||||||
|
// Strings can serve as the identifier when Mecanim is used as the state machine and state source.
|
||||||
|
// If you don't use Mecanim, using custom ScriptableObjects may be a more efficient way to store information about the state and its connection with specific Spine animations.
|
||||||
|
|
||||||
|
// This animation handle implementation also comes with a dummy implementation of transition-handling.
|
||||||
|
public class SkeletonAnimationHandleExample : MonoBehaviour {
|
||||||
public SkeletonAnimation skeletonAnimation;
|
public SkeletonAnimation skeletonAnimation;
|
||||||
public List<StateNameToAnimationReference> statesAndAnimations = new List<StateNameToAnimationReference>();
|
public List<StateNameToAnimationReference> statesAndAnimations = new List<StateNameToAnimationReference>();
|
||||||
public List<AnimationTransition> transitions = new List<AnimationTransition>();
|
public List<AnimationTransition> transitions = new List<AnimationTransition>(); // Alternately, an AnimationPair-Animation Dictionary (commented out) can be used for more efficient lookups.
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class StateNameToAnimationReference {
|
public class StateNameToAnimationReference {
|
||||||
@ -17,31 +50,46 @@ namespace Spine.Unity.Examples {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public struct AnimationTransition {
|
public class AnimationTransition {
|
||||||
public AnimationReferenceAsset from;
|
public AnimationReferenceAsset from;
|
||||||
public AnimationReferenceAsset to;
|
public AnimationReferenceAsset to;
|
||||||
public AnimationReferenceAsset transition;
|
public AnimationReferenceAsset transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly Dictionary<Spine.AnimationStateData.AnimationPair, Spine.Animation> transitionDictionary = new Dictionary<AnimationStateData.AnimationPair, Animation>(Spine.AnimationStateData.AnimationPairComparer.Instance);
|
//readonly Dictionary<Spine.AnimationStateData.AnimationPair, Spine.Animation> transitionDictionary = new Dictionary<AnimationStateData.AnimationPair, Animation>(Spine.AnimationStateData.AnimationPairComparer.Instance);
|
||||||
|
|
||||||
|
public Spine.Animation TargetAnimation { get; private set; }
|
||||||
|
|
||||||
void Awake () {
|
void Awake () {
|
||||||
|
// Initialize AnimationReferenceAssets
|
||||||
|
foreach (var entry in statesAndAnimations) {
|
||||||
|
entry.animation.Initialize();
|
||||||
|
}
|
||||||
foreach (var entry in transitions) {
|
foreach (var entry in transitions) {
|
||||||
// If uninitialized
|
|
||||||
entry.from.Initialize();
|
entry.from.Initialize();
|
||||||
entry.to.Initialize();
|
entry.to.Initialize();
|
||||||
entry.transition.Initialize();
|
entry.transition.Initialize();
|
||||||
|
|
||||||
transitionDictionary.Add(new AnimationStateData.AnimationPair(entry.from.Animation, entry.to.Animation), entry.transition.Animation);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build Dictionary
|
||||||
|
//foreach (var entry in transitions) {
|
||||||
|
// transitionDictionary.Add(new AnimationStateData.AnimationPair(entry.from.Animation, entry.to.Animation), entry.transition.Animation);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Sets the horizontal flip state of the skeleton based on a nonzero float. If negative, the skeleton is flipped. If positive, the skeleton is not flipped.</summary>
|
||||||
public void SetFlip (float horizontal) {
|
public void SetFlip (float horizontal) {
|
||||||
if (horizontal != 0) {
|
if (horizontal != 0) {
|
||||||
skeletonAnimation.Skeleton.ScaleX = horizontal > 0 ? 1f : -1f;
|
skeletonAnimation.Skeleton.ScaleX = horizontal > 0 ? 1f : -1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Plays an animation based on the state name.</summary>
|
||||||
|
public void PlayAnimationForState (string stateShortName, int layerIndex) {
|
||||||
|
PlayAnimationForState(StringToHash(stateShortName), layerIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Plays an animation based on the hash of the state name.</summary>
|
||||||
public void PlayAnimationForState (int shortNameHash, int layerIndex) {
|
public void PlayAnimationForState (int shortNameHash, int layerIndex) {
|
||||||
var foundAnimation = GetAnimationForState(shortNameHash);
|
var foundAnimation = GetAnimationForState(shortNameHash);
|
||||||
if (foundAnimation == null)
|
if (foundAnimation == null)
|
||||||
@ -50,21 +98,25 @@ namespace Spine.Unity.Examples {
|
|||||||
PlayNewAnimation(foundAnimation, layerIndex);
|
PlayNewAnimation(foundAnimation, layerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Gets a Spine Animation based on the state name.</summary>
|
||||||
|
public Spine.Animation GetAnimationForState (string stateShortName) {
|
||||||
|
return GetAnimationForState(StringToHash(stateShortName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Gets a Spine Animation based on the hash of the state name.</summary>
|
||||||
public Spine.Animation GetAnimationForState (int shortNameHash) {
|
public Spine.Animation GetAnimationForState (int shortNameHash) {
|
||||||
var foundState = statesAndAnimations.Find(entry => Animator.StringToHash(entry.stateName) == shortNameHash);
|
var foundState = statesAndAnimations.Find(entry => StringToHash(entry.stateName) == shortNameHash);
|
||||||
return (foundState == null) ? null : foundState.animation;
|
return (foundState == null) ? null : foundState.animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayNewAnimation (Spine.Animation target, int layerIndex) {
|
/// <summary>Play an animation. If a transition animation is defined, the transition is played before the target animation being passed.</summary>
|
||||||
|
public void PlayNewAnimation (Spine.Animation target, int layerIndex) {
|
||||||
Spine.Animation transition = null;
|
Spine.Animation transition = null;
|
||||||
Spine.Animation current = null;
|
Spine.Animation current = null;
|
||||||
|
|
||||||
var currentTrackEntry = skeletonAnimation.AnimationState.GetCurrent(layerIndex);
|
current = GetCurrentAnimation(layerIndex);
|
||||||
if (currentTrackEntry != null) {
|
|
||||||
current = currentTrackEntry.Animation;
|
|
||||||
if (current != null)
|
if (current != null)
|
||||||
transitionDictionary.TryGetValue(new AnimationStateData.AnimationPair(current, target), out transition);
|
transition = TryGetTransition(current, target);
|
||||||
}
|
|
||||||
|
|
||||||
if (transition != null) {
|
if (transition != null) {
|
||||||
skeletonAnimation.AnimationState.SetAnimation(layerIndex, transition, false);
|
skeletonAnimation.AnimationState.SetAnimation(layerIndex, transition, false);
|
||||||
@ -72,6 +124,42 @@ namespace Spine.Unity.Examples {
|
|||||||
} else {
|
} else {
|
||||||
skeletonAnimation.AnimationState.SetAnimation(layerIndex, target, true);
|
skeletonAnimation.AnimationState.SetAnimation(layerIndex, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.TargetAnimation = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Play a non-looping animation once then continue playing the state animation.</summary>
|
||||||
|
public void PlayOneShot (Spine.Animation oneShot, int layerIndex) {
|
||||||
|
var state = skeletonAnimation.AnimationState;
|
||||||
|
state.SetAnimation(0, oneShot, false);
|
||||||
|
|
||||||
|
var transition = TryGetTransition(oneShot, TargetAnimation);
|
||||||
|
if (transition != null)
|
||||||
|
state.AddAnimation(0, transition, false, 0f);
|
||||||
|
|
||||||
|
state.AddAnimation(0, this.TargetAnimation, true, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
Spine.Animation TryGetTransition (Spine.Animation from, Spine.Animation to) {
|
||||||
|
foreach (var transition in transitions) {
|
||||||
|
if (transition.from.Animation == from && transition.to.Animation == to) {
|
||||||
|
return transition.transition.Animation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
//Spine.Animation foundTransition = null;
|
||||||
|
//transitionDictionary.TryGetValue(new AnimationStateData.AnimationPair(from, to), out foundTransition);
|
||||||
|
//return foundTransition;
|
||||||
|
}
|
||||||
|
|
||||||
|
Spine.Animation GetCurrentAnimation (int layerIndex) {
|
||||||
|
var currentTrackEntry = skeletonAnimation.AnimationState.GetCurrent(layerIndex);
|
||||||
|
return (currentTrackEntry != null) ? currentTrackEntry.Animation : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int StringToHash (string s) {
|
||||||
|
return Animator.StringToHash(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,8 +69,8 @@ namespace Spine.Unity {
|
|||||||
sa.initialFlipX = this.initialFlipX;
|
sa.initialFlipX = this.initialFlipX;
|
||||||
sa.initialFlipY = this.initialFlipY;
|
sa.initialFlipY = this.initialFlipY;
|
||||||
var skeleton = sa.skeleton;
|
var skeleton = sa.skeleton;
|
||||||
skeleton.ScaleX = this.initialFlipX ? 1 : -1;
|
skeleton.ScaleX = this.initialFlipX ? -1 : 1;
|
||||||
skeleton.ScaleY = this.initialFlipY ? 1 : -1;
|
skeleton.ScaleY = this.initialFlipY ? -1 : 1;
|
||||||
|
|
||||||
sa.Initialize(false);
|
sa.Initialize(false);
|
||||||
skeletonAnimations.Add(sa);
|
skeletonAnimations.Add(sa);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 6bc52290ef03f2846ba38d67e2823598
|
guid: 6bc52290ef03f2846ba38d67e2823598
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName:
|
fileIDToRecycleName:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 12c126994123f12468cf4c5a2684078a
|
guid: 12c126994123f12468cf4c5a2684078a
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649744
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName:
|
fileIDToRecycleName:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 49441e5a1682e564694545bd9b509785
|
guid: 49441e5a1682e564694545bd9b509785
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: ddb89f63d0296cf4f8572b0448bb6b30
|
guid: ddb89f63d0296cf4f8572b0448bb6b30
|
||||||
timeCreated: 1528393444
|
timeCreated: 1544649747
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName:
|
fileIDToRecycleName:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 57b57f94df266f94ea0981915a4472e1
|
guid: 57b57f94df266f94ea0981915a4472e1
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a11301aad15ed6b4995485a02a81b132
|
guid: a11301aad15ed6b4995485a02a81b132
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649746
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5fb7efec30c79cb46a705e0d04debb04
|
guid: 5fb7efec30c79cb46a705e0d04debb04
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 25b07e861d1a62f4db687c871e4a3828
|
guid: 25b07e861d1a62f4db687c871e4a3828
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649744
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b29bbacbc2368c94a9c942d176ac6f59
|
guid: b29bbacbc2368c94a9c942d176ac6f59
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649746
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4261719a8f729a644b2dab6113d1b0ea
|
guid: 4261719a8f729a644b2dab6113d1b0ea
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName:
|
fileIDToRecycleName:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 33e128e17951b4a42b17608ff79ba5c5
|
guid: 33e128e17951b4a42b17608ff79ba5c5
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649744
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 33f10ea7e20549d40a1c23a1adc3f760
|
guid: 33f10ea7e20549d40a1c23a1adc3f760
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649744
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ MonoBehaviour:
|
|||||||
- {fileID: 11400000, guid: 19fcd9c1051e4304eb095fe0dd2ae4bf, type: 2}
|
- {fileID: 11400000, guid: 19fcd9c1051e4304eb095fe0dd2ae4bf, type: 2}
|
||||||
scale: 0.01
|
scale: 0.01
|
||||||
skeletonJSON: {fileID: 4900000, guid: f1532150c1933c944b8fee0311da4401, type: 3}
|
skeletonJSON: {fileID: 4900000, guid: f1532150c1933c944b8fee0311da4401, type: 3}
|
||||||
|
skeletonDataModifiers: []
|
||||||
fromAnimation: []
|
fromAnimation: []
|
||||||
toAnimation: []
|
toAnimation: []
|
||||||
duration: []
|
duration: []
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4ea2c33e839afb34c98f66e892b3b2d2
|
guid: 4ea2c33e839afb34c98f66e892b3b2d2
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
|
|||||||
@ -31,5 +31,5 @@ MonoBehaviour:
|
|||||||
- 0
|
- 0
|
||||||
- 0.05
|
- 0.05
|
||||||
- 0.05
|
- 0.05
|
||||||
defaultMix: 0
|
defaultMix: 0.05
|
||||||
controller: {fileID: 0}
|
controller: {fileID: 0}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 49bb65eefe08e424bbf7a38bc98ec638
|
guid: 49bb65eefe08e424bbf7a38bc98ec638
|
||||||
timeCreated: 1528393443
|
timeCreated: 1544649745
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName:
|
fileIDToRecycleName:
|
||||||
@ -34,8 +34,8 @@ TextureImporter:
|
|||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 0
|
enableMipMap: 1
|
||||||
sRGBTexture: 1
|
sRGBTexture: 0
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
borderMipMap: 0
|
borderMipMap: 0
|
||||||
@ -55,7 +55,7 @@ TextureImporter:
|
|||||||
maxTextureSize: 2048
|
maxTextureSize: 2048
|
||||||
textureSettings:
|
textureSettings:
|
||||||
filterMode: -1
|
filterMode: -1
|
||||||
aniso: -1
|
aniso: 16
|
||||||
mipBias: -1
|
mipBias: -1
|
||||||
wrapMode: 1
|
wrapMode: 1
|
||||||
nPOTScale: 0
|
nPOTScale: 0
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: dc1b9f9665c8aa74799404a1d2038e3d
|
guid: dc1b9f9665c8aa74799404a1d2038e3d
|
||||||
timeCreated: 1538613637
|
timeCreated: 1544649747
|
||||||
licenseType: Pro
|
licenseType: Free
|
||||||
TextureImporter:
|
TextureImporter:
|
||||||
fileIDToRecycleName: {}
|
fileIDToRecycleName: {}
|
||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user