Browse Source
Added DragAndDrop example scene Added Clickable2D and Draggable2D components to make sprites clickable and draggable. Added event handlers which list for events from the Clickable2D and Draggable2D components.master
chrisgregan
10 years ago
22 changed files with 1369 additions and 22 deletions
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 31b842588cd274091a8c7e3c0a5d5297 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,969 @@
|
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!29 &1 |
||||
SceneSettings: |
||||
m_ObjectHideFlags: 0 |
||||
m_PVSData: |
||||
m_PVSObjectsArray: [] |
||||
m_PVSPortalsArray: [] |
||||
m_OcclusionBakeSettings: |
||||
smallestOccluder: 5 |
||||
smallestHole: .25 |
||||
backfaceThreshold: 100 |
||||
--- !u!104 &2 |
||||
RenderSettings: |
||||
m_Fog: 0 |
||||
m_FogColor: {r: .5, g: .5, b: .5, a: 1} |
||||
m_FogMode: 3 |
||||
m_FogDensity: .00999999978 |
||||
m_LinearFogStart: 0 |
||||
m_LinearFogEnd: 300 |
||||
m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1} |
||||
m_SkyboxMaterial: {fileID: 0} |
||||
m_HaloStrength: .5 |
||||
m_FlareStrength: 1 |
||||
m_FlareFadeSpeed: 3 |
||||
m_HaloTexture: {fileID: 0} |
||||
m_SpotCookie: {fileID: 0} |
||||
m_ObjectHideFlags: 0 |
||||
--- !u!127 &3 |
||||
LevelGameManager: |
||||
m_ObjectHideFlags: 0 |
||||
--- !u!157 &4 |
||||
LightmapSettings: |
||||
m_ObjectHideFlags: 0 |
||||
m_LightProbes: {fileID: 0} |
||||
m_Lightmaps: [] |
||||
m_LightmapsMode: 1 |
||||
m_BakedColorSpace: 0 |
||||
m_UseDualLightmapsInForward: 0 |
||||
m_LightmapEditorSettings: |
||||
m_Resolution: 50 |
||||
m_LastUsedResolution: 0 |
||||
m_TextureWidth: 1024 |
||||
m_TextureHeight: 1024 |
||||
m_BounceBoost: 1 |
||||
m_BounceIntensity: 1 |
||||
m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1} |
||||
m_SkyLightIntensity: 0 |
||||
m_Quality: 0 |
||||
m_Bounces: 1 |
||||
m_FinalGatherRays: 1000 |
||||
m_FinalGatherContrastThreshold: .0500000007 |
||||
m_FinalGatherGradientThreshold: 0 |
||||
m_FinalGatherInterpolationPoints: 15 |
||||
m_AOAmount: 0 |
||||
m_AOMaxDistance: .100000001 |
||||
m_AOContrast: 1 |
||||
m_LODSurfaceMappingDistance: 1 |
||||
m_Padding: 0 |
||||
m_TextureCompression: 0 |
||||
m_LockAtlas: 0 |
||||
--- !u!196 &5 |
||||
NavMeshSettings: |
||||
m_ObjectHideFlags: 0 |
||||
m_BuildSettings: |
||||
agentRadius: .5 |
||||
agentHeight: 2 |
||||
agentSlope: 45 |
||||
agentClimb: .400000006 |
||||
ledgeDropHeight: 0 |
||||
maxJumpAcrossDistance: 0 |
||||
accuratePlacement: 0 |
||||
minRegionArea: 2 |
||||
widthInaccuracy: 16.666666 |
||||
heightInaccuracy: 10 |
||||
m_NavMesh: {fileID: 0} |
||||
--- !u!1 &268187667 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 268187672} |
||||
- 20: {fileID: 268187671} |
||||
- 92: {fileID: 268187670} |
||||
- 124: {fileID: 268187669} |
||||
- 81: {fileID: 268187668} |
||||
m_Layer: 0 |
||||
m_Name: Main Camera |
||||
m_TagString: MainCamera |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!81 &268187668 |
||||
AudioListener: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 268187667} |
||||
m_Enabled: 1 |
||||
--- !u!124 &268187669 |
||||
Behaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 268187667} |
||||
m_Enabled: 1 |
||||
--- !u!92 &268187670 |
||||
Behaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 268187667} |
||||
m_Enabled: 1 |
||||
--- !u!20 &268187671 |
||||
Camera: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 268187667} |
||||
m_Enabled: 1 |
||||
serializedVersion: 2 |
||||
m_ClearFlags: 1 |
||||
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438} |
||||
m_NormalizedViewPortRect: |
||||
serializedVersion: 2 |
||||
x: 0 |
||||
y: 0 |
||||
width: 1 |
||||
height: 1 |
||||
near clip plane: .300000012 |
||||
far clip plane: 1000 |
||||
field of view: 60 |
||||
orthographic: 1 |
||||
orthographic size: 5 |
||||
m_Depth: -1 |
||||
m_CullingMask: |
||||
serializedVersion: 2 |
||||
m_Bits: 4294967295 |
||||
m_RenderingPath: -1 |
||||
m_TargetTexture: {fileID: 0} |
||||
m_TargetDisplay: 0 |
||||
m_HDR: 0 |
||||
m_OcclusionCulling: 1 |
||||
m_StereoConvergence: 10 |
||||
m_StereoSeparation: .0219999999 |
||||
--- !u!4 &268187672 |
||||
Transform: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 268187667} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: -10} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 0 |
||||
--- !u!1 &299700058 |
||||
GameObject: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 299700060} |
||||
- 114: {fileID: 299700059} |
||||
m_Layer: 0 |
||||
m_Name: _FungusState |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!114 &299700059 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 299700058} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
selectedFungusScript: {fileID: 2019116668} |
||||
--- !u!4 &299700060 |
||||
Transform: |
||||
m_ObjectHideFlags: 1 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 299700058} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 0 |
||||
--- !u!1 &606394391 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 606394394} |
||||
- 212: {fileID: 606394393} |
||||
- 58: {fileID: 606394392} |
||||
m_Layer: 0 |
||||
m_Name: DragTarget |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!58 &606394392 |
||||
CircleCollider2D: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 606394391} |
||||
m_Enabled: 1 |
||||
m_Material: {fileID: 0} |
||||
m_IsTrigger: 0 |
||||
m_Radius: 1.5 |
||||
m_Center: {x: 0, y: 0} |
||||
--- !u!212 &606394393 |
||||
SpriteRenderer: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 606394391} |
||||
m_Enabled: 1 |
||||
m_CastShadows: 0 |
||||
m_ReceiveShadows: 0 |
||||
m_LightmapIndex: 255 |
||||
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} |
||||
m_Materials: |
||||
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} |
||||
m_SubsetIndices: |
||||
m_StaticBatchRoot: {fileID: 0} |
||||
m_UseLightProbes: 0 |
||||
m_LightProbeAnchor: {fileID: 0} |
||||
m_ScaleInLightmap: 1 |
||||
m_SortingLayerID: 0 |
||||
m_SortingOrder: 0 |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Color: {r: 1, g: 1, b: 1, a: .368627459} |
||||
--- !u!4 &606394394 |
||||
Transform: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 606394391} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 3.0999999, y: .370000005, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 3 |
||||
--- !u!1 &1081858233 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 1081858238} |
||||
- 212: {fileID: 1081858237} |
||||
- 61: {fileID: 1081858235} |
||||
- 50: {fileID: 1081858234} |
||||
- 114: {fileID: 1081858236} |
||||
m_Layer: 0 |
||||
m_Name: Draggable |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!50 &1081858234 |
||||
Rigidbody2D: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1081858233} |
||||
m_Mass: 1 |
||||
m_LinearDrag: 0 |
||||
m_AngularDrag: .0500000007 |
||||
m_GravityScale: 1 |
||||
m_FixedAngle: 0 |
||||
m_IsKinematic: 1 |
||||
m_Interpolate: 0 |
||||
m_SleepingMode: 1 |
||||
m_CollisionDetection: 0 |
||||
--- !u!61 &1081858235 |
||||
BoxCollider2D: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1081858233} |
||||
m_Enabled: 1 |
||||
m_Material: {fileID: 0} |
||||
m_IsTrigger: 1 |
||||
m_Size: {x: 3, y: 3} |
||||
m_Center: {x: 0, y: 0} |
||||
--- !u!114 &1081858236 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1081858233} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 18a0e492e94664ec0ac44d252c40e3a7, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
dragEnabled: 1 |
||||
returnToStartPos: 1 |
||||
returnDuration: 1 |
||||
--- !u!212 &1081858237 |
||||
SpriteRenderer: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1081858233} |
||||
m_Enabled: 1 |
||||
m_CastShadows: 0 |
||||
m_ReceiveShadows: 0 |
||||
m_LightmapIndex: 255 |
||||
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} |
||||
m_Materials: |
||||
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} |
||||
m_SubsetIndices: |
||||
m_StaticBatchRoot: {fileID: 0} |
||||
m_UseLightProbes: 0 |
||||
m_LightProbeAnchor: {fileID: 0} |
||||
m_ScaleInLightmap: 1 |
||||
m_SortingLayerID: 0 |
||||
m_SortingOrder: 0 |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
||||
--- !u!4 &1081858238 |
||||
Transform: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1081858233} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: -.730000019, y: .360000014, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 2 |
||||
--- !u!115 &1447151998 |
||||
MonoScript: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_Name: |
||||
serializedVersion: 4 |
||||
m_Script: |
||||
m_DefaultReferences: {} |
||||
m_Icon: {fileID: 0} |
||||
m_EditorGraphData: {fileID: 0} |
||||
m_ExecutionOrder: 0 |
||||
m_ClassName: SetActive |
||||
m_Namespace: Fungus |
||||
m_AssemblyName: Assembly-CSharp.dll |
||||
m_IsEditorScript: 0 |
||||
--- !u!1 &1637100245 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 1637100250} |
||||
- 212: {fileID: 1637100249} |
||||
- 61: {fileID: 1637100248} |
||||
- 114: {fileID: 1637100246} |
||||
m_Layer: 0 |
||||
m_Name: Clickable |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!114 &1637100246 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1637100245} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: cc03961113fa349c09cb06ef2911013d, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
clickEnabled: 1 |
||||
--- !u!61 &1637100248 |
||||
BoxCollider2D: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1637100245} |
||||
m_Enabled: 1 |
||||
m_Material: {fileID: 0} |
||||
m_IsTrigger: 0 |
||||
m_Size: {x: 3, y: 3} |
||||
m_Center: {x: 0, y: 0} |
||||
--- !u!212 &1637100249 |
||||
SpriteRenderer: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1637100245} |
||||
m_Enabled: 1 |
||||
m_CastShadows: 0 |
||||
m_ReceiveShadows: 0 |
||||
m_LightmapIndex: 255 |
||||
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0} |
||||
m_Materials: |
||||
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} |
||||
m_SubsetIndices: |
||||
m_StaticBatchRoot: {fileID: 0} |
||||
m_UseLightProbes: 0 |
||||
m_LightProbeAnchor: {fileID: 0} |
||||
m_ScaleInLightmap: 1 |
||||
m_SortingLayerID: 0 |
||||
m_SortingOrder: 0 |
||||
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3} |
||||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
||||
--- !u!4 &1637100250 |
||||
Transform: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 1637100245} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: -4.67999983, y: .370000005, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 1 |
||||
--- !u!1 &2019116667 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
serializedVersion: 4 |
||||
m_Component: |
||||
- 4: {fileID: 2019116689} |
||||
- 114: {fileID: 2019116668} |
||||
- 114: {fileID: 2019116687} |
||||
- 114: {fileID: 2019116685} |
||||
- 114: {fileID: 2019116683} |
||||
- 114: {fileID: 2019116680} |
||||
- 114: {fileID: 2019116669} |
||||
- 114: {fileID: 2019116670} |
||||
- 114: {fileID: 2019116677} |
||||
- 114: {fileID: 2019116676} |
||||
- 114: {fileID: 2019116675} |
||||
- 114: {fileID: 2019116674} |
||||
- 114: {fileID: 2019116672} |
||||
- 114: {fileID: 2019116671} |
||||
- 114: {fileID: 2019116690} |
||||
- 114: {fileID: 2019116691} |
||||
- 114: {fileID: 2019116682} |
||||
- 114: {fileID: 2019116679} |
||||
- 114: {fileID: 2019116673} |
||||
- 114: {fileID: 2019116681} |
||||
- 114: {fileID: 2019116686} |
||||
- 114: {fileID: 2019116684} |
||||
- 114: {fileID: 2019116693} |
||||
- 114: {fileID: 2019116692} |
||||
- 114: {fileID: 2019116688} |
||||
- 114: {fileID: 2019116678} |
||||
m_Layer: 0 |
||||
m_Name: FungusScript |
||||
m_TagString: Untagged |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!114 &2019116668 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
scrollPos: {x: 241, y: -25} |
||||
variablesScrollPos: {x: 0, y: 0} |
||||
variablesExpanded: 1 |
||||
zoom: 1 |
||||
scrollViewRect: |
||||
serializedVersion: 2 |
||||
x: -591 |
||||
y: -353 |
||||
width: 1887 |
||||
height: 970 |
||||
selectedSequence: {fileID: 2019116680} |
||||
selectedCommands: [] |
||||
variables: [] |
||||
runSlowDuration: .25 |
||||
colorCommands: 1 |
||||
hideComponents: 1 |
||||
--- !u!114 &2019116669 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
nodeRect: |
||||
serializedVersion: 2 |
||||
x: 141 |
||||
y: 86 |
||||
width: 120 |
||||
height: 30 |
||||
sequenceName: Drag Completed |
||||
runSlowInEditor: 0 |
||||
eventHandler: {fileID: 2019116681} |
||||
commandList: |
||||
- {fileID: 2019116672} |
||||
- {fileID: 2019116670} |
||||
- {fileID: 2019116671} |
||||
--- !u!114 &2019116670 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 1447151998} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetGameObject: {fileID: 1081858233} |
||||
activeState: |
||||
booleanRef: {fileID: 0} |
||||
booleanVal: 0 |
||||
--- !u!114 &2019116671 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: c4998e756a5d84f4ab55e075dad751b1, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetObject: |
||||
targetType: 1 |
||||
otherGameObject: {fileID: 606394391} |
||||
tweenName: |
||||
duration: 1 |
||||
easeType: 2 |
||||
loopType: 0 |
||||
waitUntilFinished: 0 |
||||
offset: {x: .5, y: .5, z: 0} |
||||
--- !u!114 &2019116672 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ea6e8f632db87477eb750446b28d73a3, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
commentText: Destroy the dragged object and scale up the target object |
||||
--- !u!114 &2019116673 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: b30a6fae3a8a24fa097a262570f519ce, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
parentSequence: {fileID: 2019116685} |
||||
draggableObject: {fileID: 1081858236} |
||||
--- !u!114 &2019116674 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ea6e8f632db87477eb750446b28d73a3, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
commentText: Decrease scale when drag is cancelled |
||||
--- !u!114 &2019116675 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ea6e8f632db87477eb750446b28d73a3, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
commentText: Increase scale when drag starts |
||||
--- !u!114 &2019116676 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: c4998e756a5d84f4ab55e075dad751b1, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetObject: |
||||
targetType: 1 |
||||
otherGameObject: {fileID: 1081858233} |
||||
tweenName: |
||||
duration: .100000001 |
||||
easeType: 2 |
||||
loopType: 0 |
||||
waitUntilFinished: 0 |
||||
offset: {x: -.25, y: -.25, z: 0} |
||||
--- !u!114 &2019116677 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: c4998e756a5d84f4ab55e075dad751b1, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetObject: |
||||
targetType: 1 |
||||
otherGameObject: {fileID: 1081858233} |
||||
tweenName: |
||||
duration: .100000001 |
||||
easeType: 2 |
||||
loopType: 0 |
||||
waitUntilFinished: 0 |
||||
offset: {x: .25, y: .25, z: 0} |
||||
--- !u!114 &2019116678 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 538cc00e40e51400fb9bb5f6d8a9759c, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
parentSequence: {fileID: 2019116687} |
||||
draggableObject: {fileID: 1081858236} |
||||
--- !u!114 &2019116679 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ea6e8f632db87477eb750446b28d73a3, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
commentText: Do a punch rotation effect when the dragged object stops touching the |
||||
target object. |
||||
--- !u!114 &2019116680 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
nodeRect: |
||||
serializedVersion: 2 |
||||
x: 306 |
||||
y: 142 |
||||
width: 120 |
||||
height: 30 |
||||
sequenceName: Drag Exited |
||||
runSlowInEditor: 0 |
||||
eventHandler: {fileID: 2019116684} |
||||
commandList: |
||||
- {fileID: 2019116679} |
||||
- {fileID: 2019116691} |
||||
--- !u!114 &2019116681 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 8dbb95c9958f04152aa2e7a65413eb4d, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
parentSequence: {fileID: 2019116669} |
||||
draggableObject: {fileID: 1081858236} |
||||
targetObject: {fileID: 606394392} |
||||
--- !u!114 &2019116682 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ea6e8f632db87477eb750446b28d73a3, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
commentText: Do a punch position effect when the dragged object starts touching |
||||
the target object. |
||||
--- !u!114 &2019116683 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
nodeRect: |
||||
serializedVersion: 2 |
||||
x: 306 |
||||
y: 87 |
||||
width: 120 |
||||
height: 30 |
||||
sequenceName: Drag Entered |
||||
runSlowInEditor: 0 |
||||
eventHandler: {fileID: 2019116686} |
||||
commandList: |
||||
- {fileID: 2019116682} |
||||
- {fileID: 2019116690} |
||||
--- !u!114 &2019116684 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ca6aad5e417a14505886d0b0307bff32, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
parentSequence: {fileID: 2019116680} |
||||
draggableObject: {fileID: 1081858236} |
||||
targetObject: {fileID: 606394392} |
||||
--- !u!114 &2019116685 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
nodeRect: |
||||
serializedVersion: 2 |
||||
x: -33 |
||||
y: 142 |
||||
width: 120 |
||||
height: 30 |
||||
sequenceName: Drag Cancelled |
||||
runSlowInEditor: 0 |
||||
eventHandler: {fileID: 2019116673} |
||||
commandList: |
||||
- {fileID: 2019116674} |
||||
- {fileID: 2019116676} |
||||
--- !u!114 &2019116686 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: eed081ad4ebea41c580e1cdd6fe65ba0, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
parentSequence: {fileID: 2019116683} |
||||
draggableObject: {fileID: 1081858236} |
||||
targetObject: {fileID: 606394392} |
||||
--- !u!114 &2019116687 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
nodeRect: |
||||
serializedVersion: 2 |
||||
x: -35 |
||||
y: 86 |
||||
width: 120 |
||||
height: 30 |
||||
sequenceName: Drag Start |
||||
runSlowInEditor: 0 |
||||
eventHandler: {fileID: 2019116678} |
||||
commandList: |
||||
- {fileID: 2019116675} |
||||
- {fileID: 2019116677} |
||||
--- !u!114 &2019116688 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 358f65040c3ef4327b70b2813cc197c7, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetObject: |
||||
targetType: 1 |
||||
otherGameObject: {fileID: 1637100245} |
||||
tweenName: |
||||
duration: 1 |
||||
easeType: 2 |
||||
loopType: 0 |
||||
waitUntilFinished: 1 |
||||
amount: {x: 1, y: 1, z: 0} |
||||
isLocal: 0 |
||||
axis: 0 |
||||
--- !u!4 &2019116689 |
||||
Transform: |
||||
m_ObjectHideFlags: 0 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: -1.15999997, y: .340000004, z: 0} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 4 |
||||
--- !u!114 &2019116690 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 720f059c883c4402c89fcc507d5f7e0d, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetObject: |
||||
targetType: 1 |
||||
otherGameObject: {fileID: 606394391} |
||||
tweenName: |
||||
duration: 1 |
||||
easeType: 2 |
||||
loopType: 0 |
||||
waitUntilFinished: 0 |
||||
amount: {x: 0, y: 1, z: 0} |
||||
space: 1 |
||||
--- !u!114 &2019116691 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: ea1bc1400ac79424ba3c1aca77fb5d42, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
errorMessage: |
||||
indentLevel: 0 |
||||
targetObject: |
||||
targetType: 1 |
||||
otherGameObject: {fileID: 606394391} |
||||
tweenName: |
||||
duration: 1 |
||||
easeType: 2 |
||||
loopType: 0 |
||||
waitUntilFinished: 0 |
||||
amount: {x: 0, y: 0, z: 45} |
||||
space: 1 |
||||
--- !u!114 &2019116692 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: a49012bdc794e429686c1eff7d9ced90, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
parentSequence: {fileID: 2019116693} |
||||
clickableObject: {fileID: 1637100246} |
||||
--- !u!114 &2019116693 |
||||
MonoBehaviour: |
||||
m_ObjectHideFlags: 2 |
||||
m_PrefabParentObject: {fileID: 0} |
||||
m_PrefabInternal: {fileID: 0} |
||||
m_GameObject: {fileID: 2019116667} |
||||
m_Enabled: 1 |
||||
m_EditorHideFlags: 0 |
||||
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} |
||||
m_Name: |
||||
m_EditorClassIdentifier: |
||||
nodeRect: |
||||
serializedVersion: 2 |
||||
x: 142 |
||||
y: 142 |
||||
width: 120 |
||||
height: 30 |
||||
sequenceName: New Sequence |
||||
runSlowInEditor: 0 |
||||
eventHandler: {fileID: 2019116692} |
||||
commandList: |
||||
- {fileID: 2019116688} |
@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 3cf236489696f4df5b4c21e578e17045 |
||||
DefaultImporter: |
||||
userData: |
@ -1,4 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 76e39315b64144d3b86c1965e671eb4c |
||||
TextScriptImporter: |
||||
userData: |
@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2 |
||||
guid: c5e8d406029f34a579d94564b4cb7d3b |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -0,0 +1,24 @@
|
||||
using UnityEngine; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[EventHandlerInfo("Sprites", |
||||
"Drag Cancelled", |
||||
"The sequence will execute when the player drags an object and releases it without dropping it on a target object.")] |
||||
public class DragCancelled : EventHandler |
||||
{ |
||||
public Draggable2D draggableObject; |
||||
|
||||
public virtual void OnDragCancelled(Draggable2D draggableObject) |
||||
{ |
||||
if (draggableObject == this.draggableObject) |
||||
{ |
||||
ExecuteSequence(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: b30a6fae3a8a24fa097a262570f519ce |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,52 @@
|
||||
using UnityEngine; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[EventHandlerInfo("Sprites", |
||||
"Drag Completed", |
||||
"The sequence will execute when the player drags an object and successfully drops it on a target object.")] |
||||
public class DragCompleted : EventHandler |
||||
{ |
||||
public Draggable2D draggableObject; |
||||
public Collider2D targetObject; |
||||
|
||||
// There's no way to poll if an object is touching another object, so |
||||
// we have to listen to the callbacks and track the touching state ourselves. |
||||
bool overTarget = false; |
||||
|
||||
public virtual bool IsOverTarget() |
||||
{ |
||||
return overTarget; |
||||
} |
||||
|
||||
public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject) |
||||
{ |
||||
if (this.targetObject != null && |
||||
targetObject == this.targetObject) |
||||
{ |
||||
overTarget = true; |
||||
} |
||||
} |
||||
|
||||
public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject) |
||||
{ |
||||
if (this.targetObject != null && |
||||
targetObject == this.targetObject) |
||||
{ |
||||
overTarget = false; |
||||
} |
||||
} |
||||
|
||||
public virtual void OnDragCompleted(Draggable2D draggableObject) |
||||
{ |
||||
if (draggableObject == this.draggableObject && |
||||
overTarget) |
||||
{ |
||||
ExecuteSequence(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 8dbb95c9958f04152aa2e7a65413eb4d |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,26 @@
|
||||
using UnityEngine; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
[EventHandlerInfo("Sprites", |
||||
"Drag Entered", |
||||
"The sequence will execute when the player is dragging an object which starts touching the target object.")] |
||||
public class DragEntered : EventHandler |
||||
{ |
||||
public Draggable2D draggableObject; |
||||
public Collider2D targetObject; |
||||
|
||||
public virtual void OnDragEntered(Draggable2D draggableObject, Collider2D targetObject) |
||||
{ |
||||
if (draggableObject == this.draggableObject && |
||||
targetObject == this.targetObject) |
||||
{ |
||||
ExecuteSequence(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: eed081ad4ebea41c580e1cdd6fe65ba0 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,26 @@
|
||||
using UnityEngine; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
[EventHandlerInfo("Sprites", |
||||
"Drag Exited", |
||||
"The sequence will execute when the player is dragging an object which stops touching the target object.")] |
||||
public class DragExited : EventHandler |
||||
{ |
||||
public Draggable2D draggableObject; |
||||
public Collider2D targetObject; |
||||
|
||||
public virtual void OnDragExited(Draggable2D draggableObject, Collider2D targetObject) |
||||
{ |
||||
if (draggableObject == this.draggableObject && |
||||
targetObject == this.targetObject) |
||||
{ |
||||
ExecuteSequence(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: ca6aad5e417a14505886d0b0307bff32 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,23 @@
|
||||
using UnityEngine; |
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[EventHandlerInfo("Sprites", |
||||
"Drag Started", |
||||
"The sequence will execute when the player starts dragging an object.")] |
||||
public class DragStarted : EventHandler |
||||
{ |
||||
public Draggable2D draggableObject; |
||||
|
||||
public virtual void OnDragStarted(Draggable2D draggableObject) |
||||
{ |
||||
if (draggableObject == this.draggableObject) |
||||
{ |
||||
ExecuteSequence(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 538cc00e40e51400fb9bb5f6d8a9759c |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,21 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
[EventHandlerInfo("Sprites", |
||||
"Object Clicked", |
||||
"The sequence will execute when the user clicks or taps on the clickable object.")] |
||||
public class ObjectClicked : EventHandler |
||||
{ |
||||
public Clickable2D clickableObject; |
||||
|
||||
public virtual void OnObjectClicked(Clickable2D clickableObject) |
||||
{ |
||||
if (clickableObject == this.clickableObject) |
||||
{ |
||||
ExecuteSequence(); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2 |
||||
guid: a49012bdc794e429686c1eff7d9ced90 |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
@ -0,0 +1,33 @@
|
||||
using UnityEngine; |
||||
using UnityEngine.Events; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
/** |
||||
* Detects mouse clicks and touches on a Game Object, and sends an event to all Fungus Script event handlers in the scene. |
||||
* The Game Object must have a Collider2D component attached. |
||||
* Use in conjunction with the ObjectClicked Fungus Script event handler. |
||||
*/ |
||||
public class Clickable2D : MonoBehaviour |
||||
{ |
||||
[Tooltip("Is object clicking enabled")] |
||||
public bool clickEnabled = true; |
||||
|
||||
void OnMouseDown() |
||||
{ |
||||
if (!clickEnabled) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
// TODO: Cache these object for faster lookup |
||||
ObjectClicked[] handlers = GameObject.FindObjectsOfType<ObjectClicked>(); |
||||
foreach (ObjectClicked handler in handlers) |
||||
{ |
||||
handler.OnObjectClicked(this); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,18 +0,0 @@
|
||||
using UnityEngine; |
||||
using UnityEngine.Events; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
public class ClickableSprite : MonoBehaviour |
||||
{ |
||||
public UnityEvent onSpriteClick; |
||||
|
||||
void OnMouseDown() |
||||
{ |
||||
onSpriteClick.Invoke(); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,125 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
/** |
||||
* Detects drag and drop interactions on a Game Object, and sends events to all Fungus Script event handlers in the scene. |
||||
* The Game Object must have Collider2D & RigidBody components attached. |
||||
* The Collider2D must have the Is Trigger property set to true. |
||||
* The RigidBody would typically have the Is Kinematic property set to true, unless you want the object to move around using physics. |
||||
* Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers. |
||||
*/ |
||||
public class Draggable2D : MonoBehaviour |
||||
{ |
||||
[Tooltip("Is object dragging enabled")] |
||||
public bool dragEnabled = true; |
||||
|
||||
[Tooltip("Move object back to its starting position when drag is released")] |
||||
public bool returnToStartPos = true; |
||||
|
||||
[Tooltip("Time object takes to return to its starting position")] |
||||
public float returnDuration = 1f; |
||||
|
||||
Vector3 startingPosition; |
||||
|
||||
protected virtual void OnMouseDown() |
||||
{ |
||||
startingPosition = transform.position; |
||||
|
||||
foreach (DragStarted handler in GetHandlers<DragStarted>()) |
||||
{ |
||||
handler.OnDragStarted(this); |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnMouseDrag() |
||||
{ |
||||
if (!dragEnabled) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
float x = Input.mousePosition.x; |
||||
float y = Input.mousePosition.y; |
||||
float z = transform.position.z; |
||||
|
||||
Vector3 newPosition = Camera.main.ScreenToWorldPoint(new Vector3(x, y, 10f)); |
||||
newPosition.z = z; |
||||
|
||||
if (rigidbody2D != null) |
||||
{ |
||||
rigidbody2D.MovePosition(newPosition); |
||||
} |
||||
else |
||||
{ |
||||
transform.position = newPosition; |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnMouseUp() |
||||
{ |
||||
bool dragCompleted = false; |
||||
|
||||
DragCompleted[] handlers = GetHandlers<DragCompleted>(); |
||||
foreach (DragCompleted handler in handlers) |
||||
{ |
||||
if (handler.draggableObject == this) |
||||
{ |
||||
if (handler.IsOverTarget()) |
||||
{ |
||||
handler.OnDragCompleted(this); |
||||
dragCompleted = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!dragCompleted) |
||||
{ |
||||
foreach (DragCancelled handler in GetHandlers<DragCancelled>()) |
||||
{ |
||||
handler.OnDragCancelled(this); |
||||
} |
||||
} |
||||
|
||||
if (returnToStartPos) |
||||
{ |
||||
iTween.MoveTo(gameObject, startingPosition, returnDuration); |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnTriggerEnter2D(Collider2D other) |
||||
{ |
||||
foreach (DragEntered handler in GetHandlers<DragEntered>()) |
||||
{ |
||||
handler.OnDragEntered(this, other); |
||||
} |
||||
|
||||
foreach (DragCompleted handler in GetHandlers<DragCompleted>()) |
||||
{ |
||||
handler.OnDragEntered(this, other); |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnTriggerExit2D(Collider2D other) |
||||
{ |
||||
foreach (DragExited handler in GetHandlers<DragExited>()) |
||||
{ |
||||
handler.OnDragExited(this, other); |
||||
} |
||||
|
||||
foreach (DragCompleted handler in GetHandlers<DragCompleted>()) |
||||
{ |
||||
handler.OnDragExited(this, other); |
||||
} |
||||
} |
||||
|
||||
protected virtual T[] GetHandlers<T>() where T : EventHandler |
||||
{ |
||||
// TODO: Cache these object for faster lookup |
||||
return GameObject.FindObjectsOfType<T>(); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue