From 470ed2653343ff2b522dfac15f7d0173b2194027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Sun, 16 Jun 2019 12:34:21 +0300 Subject: [PATCH 1/3] Import Sprites & Change Player Colider to circle --- Assets/Prefabs/Player.prefab | 126 ++++++++------- .../Walls/bman_destructible_wall1.prefab | 4 +- .../Walls/bman_destructible_wall2.prefab | 4 +- .../Walls/bman_indestructible_wall1.prefab | 4 +- Assets/Scenes/SampleScene.unity | 148 +----------------- ...bman_sprite_crate_v01-01.png => crate.png} | Bin 17555 -> 17908 bytes ..._snowmound_v02.png.meta => crate.png.meta} | 6 +- ...sprite_snowmound_v01.png => high_snow.png} | Bin 18005 -> 17930 bytes ...ate_v01-01.png.meta => high_snow.png.meta} | 6 +- ..._sprite_snowmound_v02.png => snowball.png} | Bin 17962 -> 17858 bytes ...owmound_v01.png.meta => snowball.png.meta} | 6 +- 11 files changed, 89 insertions(+), 215 deletions(-) rename Assets/Sprites/Walls/{bman_sprite_crate_v01-01.png => crate.png} (92%) rename Assets/Sprites/Walls/{bman_sprite_snowmound_v02.png.meta => crate.png.meta} (95%) rename Assets/Sprites/Walls/{bman_sprite_snowmound_v01.png => high_snow.png} (91%) rename Assets/Sprites/Walls/{bman_sprite_crate_v01-01.png.meta => high_snow.png.meta} (95%) rename Assets/Sprites/Walls/{bman_sprite_snowmound_v02.png => snowball.png} (92%) rename Assets/Sprites/Walls/{bman_sprite_snowmound_v01.png.meta => snowball.png.meta} (95%) diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index f8fbbe4..33fc33c 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &6843575828445418657 +--- !u!1 &1778702655 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,40 +8,37 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 6843575828445418654} - - component: {fileID: 6843575828445418655} - - component: {fileID: 6843575828445418656} - - component: {fileID: 6843575828445418653} - - component: {fileID: 6843575828445418652} - - component: {fileID: 6843575828445418651} - m_Layer: 0 - m_Name: Player + - component: {fileID: 1778702656} + - component: {fileID: 1778702657} + - component: {fileID: 1778702658} + m_Layer: 15 + m_Name: Sprite m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &6843575828445418654 +--- !u!4 &1778702656 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6843575828445418657} + m_GameObject: {fileID: 1778702655} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 7.2106156} - m_LocalScale: {x: 1, y: 1, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 0} + m_Father: {fileID: 6843575828445418654} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &6843575828445418655 +--- !u!212 &1778702657 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6843575828445418657} + m_GameObject: {fileID: 1778702655} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -72,17 +69,70 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 69237087e6b0b42ac8d25d0035b2e01b, type: 3} + m_Sprite: {fileID: 21300064, guid: acfc12ff3498641aa93645b517a11af4, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 0.16, y: 0.16} + m_Size: {x: 2, y: 2} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!95 &1778702658 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1778702655} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: dc9347e7518ed4709b6cacd42554e650, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &6843575828445418657 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6843575828445418654} + - component: {fileID: 6843575828445418656} + - component: {fileID: 6843575828445418653} + - component: {fileID: 1227801303} + m_Layer: 15 + m_Name: Player + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6843575828445418654 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6843575828445418657} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 7.2106156} + m_LocalScale: {x: 1, y: 1, z: 0} + m_Children: + - {fileID: 1778702656} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &6843575828445418656 MonoBehaviour: m_ObjectHideFlags: 0 @@ -96,7 +146,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: movementSpeed: 4 - respawnPosition: {fileID: 0} --- !u!50 &6843575828445418653 Rigidbody2D: serializedVersion: 4 @@ -113,13 +162,13 @@ Rigidbody2D: m_LinearDrag: 0 m_AngularDrag: 0.05 m_GravityScale: 0 - m_Material: {fileID: 0} + m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2} m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 4 ---- !u!61 &6843575828445418652 -BoxCollider2D: +--- !u!58 &1227801303 +CircleCollider2D: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -131,35 +180,6 @@ BoxCollider2D: m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 - m_Offset: {x: 0.5144317, y: 0.50000024} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0, y: 0} - oldSize: {x: 1, y: 1} - newSize: {x: 0.16, y: 0.16} - adaptiveTilingThreshold: 0.5 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 + m_Offset: {x: 0.5, y: 0.5} serializedVersion: 2 - m_Size: {x: 0.913409, y: 0.88454485} - m_EdgeRadius: 0 ---- !u!95 &6843575828445418651 -Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6843575828445418657} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: dc9347e7518ed4709b6cacd42554e650, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 + m_Radius: 0.4 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab index 0a8544a..da3badb 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab @@ -178,12 +178,12 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 8f9176eb354da424795fcd8d93e4c02f, type: 3} + m_Sprite: {fileID: 21300000, guid: 5cd4487071acb46548e9bfad30835e56, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 1, y: 1} + m_Size: {x: 1, y: 2} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab index 41c4aa2..cb81a74 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab @@ -68,12 +68,12 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 2c89c5592e07249fd8d1f49c0e5a125e, type: 3} + m_Sprite: {fileID: 21300000, guid: 9bb63e2c621a54be6ae6b541b4499c19, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 1, y: 1} + m_Size: {x: 1, y: 2} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab b/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab index ae3649a..68273d2 100644 --- a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab @@ -161,12 +161,12 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 51730a754c8c94ac9aaf4a998edcf5e4, type: 3} + m_Sprite: {fileID: 21300000, guid: e6da7612beba841f6a44ea1c453f4b11, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 1, y: 1} + m_Size: {x: 1, y: 2} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index e11c7af..3b81639 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -8288,105 +8288,6 @@ Transform: type: 3} m_PrefabInstance: {fileID: 6843575829779162303} m_PrefabAsset: {fileID: 0} ---- !u!1 &1778702655 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1778702656} - - component: {fileID: 1778702657} - - component: {fileID: 1778702658} - m_Layer: 15 - m_Name: Sprite - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1778702656 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1778702655} - 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: 1352658977} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &1778702657 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1778702655} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - m_SelectedEditorRenderState: 0 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_Sprite: {fileID: 21300064, guid: acfc12ff3498641aa93645b517a11af4, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 2, y: 2} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!95 &1778702658 -Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1778702655} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: dc9347e7518ed4709b6cacd42554e650, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 --- !u!1001 &2013742123 PrefabInstance: m_ObjectHideFlags: 0 @@ -8547,11 +8448,6 @@ PrefabInstance: propertyPath: m_Name value: Player objectReference: {fileID: 0} - - target: {fileID: 6843575828445418657, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_Layer - value: 15 - objectReference: {fileID: 0} - target: {fileID: 6843575828445418654, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} propertyPath: m_LocalPosition.x @@ -8607,47 +8503,5 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6843575828445418656, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: respawnPosition - value: - objectReference: {fileID: 185746015} - - target: {fileID: 6843575828445418655, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_SortingOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6843575828445418655, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_Enabled - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6843575828445418652, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_Offset.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 6843575828445418652, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_Offset.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 6843575828445418652, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_Size.x - value: 0.8 - objectReference: {fileID: 0} - - target: {fileID: 6843575828445418652, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_EdgeRadius - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 6843575828445418652, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_Size.y - value: 0.8 - objectReference: {fileID: 0} - m_RemovedComponents: - - {fileID: 6843575828445418655, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} - - {fileID: 6843575828445418651, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} + m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} diff --git a/Assets/Sprites/Walls/bman_sprite_crate_v01-01.png b/Assets/Sprites/Walls/crate.png similarity index 92% rename from Assets/Sprites/Walls/bman_sprite_crate_v01-01.png rename to Assets/Sprites/Walls/crate.png index 8581ef6bd80790f002e16968ae51ba4ee50a7a2b..7fdbe92d651a68a893d85319a74722e8c6da8309 100644 GIT binary patch delta 623 zcmbQ-$@rz4QL!_?&z+Y`ii?4Pf!EW+B?w3>0I>rH8<4E-D_u8HQJl#|e52I~W=_ix zBO@y#6DyO++$^?8yg-&T6;q=$%d}+UBwa(ZqV;*2)rutvCOGe1u=)8s{hI-5KA1eiCU6I5noGB(=$S!jhm%gJA6;gjb(>DPyQ zx;TbZ+)DcM|G)iV2PU;PMz+O#5~T-LFuTbbylMz!@3Bg_!Uz?LxWHO>|IX+6jg5_o z?@yjK*?2*D-GqrC-tk5M4hk~$Y?vpwwzlu=yMr^?5+1xb+Abm)GyU0N2cHhUdjdNO z|EhVi>Au!?`&f8+jjqP0Yrj4@*XyuI?5{n#y71*0t37u6D!<(k;BWjNb4TTOtcT1uI`hUR%0%u3D#7gU0)b88tH)}}4$%WM#5+i`AB zSD102z7b1yL%*rR(Zi=_U;J_Gom!Vc7u$|qh1)0lmHc%rnsD;R!;huU{v5j{#LIDt z;p0vD%71@W7#cm!{5_M6CAVRYuD{9g_N+Fud8-{V*m_RyuseR#p0VQ|L*i>`#jiRG z>JNS8Tep1!FT;)1`dm^E7Bg;hHh=XmJHcTold|v*t{tZ)yj^~H;fg}h55@8cwwLd) zv+NR%iJvz+>(0$k>*76|q82kcN(E@0f4=M8mru(s^ju~LXM1t=|MLHNCda=@eY){` z0i)x!hCRhKHRtma8eYkS?iBuVhhgf^J;i_4&pH^Y;1R<7<;?5Y`+3LT)R`P8XYM+s z!296@!_~>NSDDZFo?BG>=`3`YO} diff --git a/Assets/Sprites/Walls/bman_sprite_snowmound_v02.png.meta b/Assets/Sprites/Walls/crate.png.meta similarity index 95% rename from Assets/Sprites/Walls/bman_sprite_snowmound_v02.png.meta rename to Assets/Sprites/Walls/crate.png.meta index 9f5e8da..170a130 100644 --- a/Assets/Sprites/Walls/bman_sprite_snowmound_v02.png.meta +++ b/Assets/Sprites/Walls/crate.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8f9176eb354da424795fcd8d93e4c02f +guid: e6da7612beba841f6a44ea1c453f4b11 TextureImporter: fileIDToRecycleName: {} externalObjects: {} @@ -45,7 +45,7 @@ TextureImporter: spriteMeshType: 1 alignment: 6 spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 64 + spritePixelsToUnits: 32 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: 800b2849763ca47ecb0c4a57d3e60146 + spriteID: e465c4daa2a0646a782802a2384f945c vertices: [] indices: edges: [] diff --git a/Assets/Sprites/Walls/bman_sprite_snowmound_v01.png b/Assets/Sprites/Walls/high_snow.png similarity index 91% rename from Assets/Sprites/Walls/bman_sprite_snowmound_v01.png rename to Assets/Sprites/Walls/high_snow.png index 4494decceacfa5d1066b13d7f848ace23ea81fa2..641271f5ff1e5898e38e3690196a386f5dbae5cd 100644 GIT binary patch delta 749 zcmccG!`RissMs0c=g!L|#l^tD!0YMZ5(K0bfY^b94MU_<)(q&@9Bzz{<$n z%3v}#iw!b2kR?sUAkD(q(lFUr*VNQ3RX54l#8Njg%`6ebH8e6zGB7bUwVZsL#Z@K6 zGR4d|#nepK(!kI{*U&K4Qa35h#8@}Y$kM_xF(uJFDKTxc3u`lrim8QpT9SEcs;*^P zvbnCAk%@t>g<*=Ru1R8IilKR8lBq?S#biScDotZq9uaP)Q zt@u4uEKSVKjLgg}bS;t$j3E9xZSrxNI!kfI$_S=YJ`?!bI-Y1b z&tRI<(E7HV;b`B#*&-GX-@U*0f7^wqkA`NCol@m>dHN)7v}rD;@-Md|I0$XWU^aVO)>u9;8B16-}kj9GcO#EVyvi8 zvgen0tLgWxa$#=!f2%hsY|??39ow^NbKdxCG4mhE$p7+h%eCjNd#VqrKilW?;sRdPuzj*$v{yfuQZ-TLp z*T>KcB@eIEy=^r7ZQ)uiUiMi-xQ_eX`cQ#M$Bxe7U+#I1S>Rez24GGDCr-_N6!9 oCrL6geAD&(^}S{D`?l|l3{1P$SUU)_zhD3YPgg&ebxsLQ012lPZ2$lO delta 811 zcmeC`VZ7SIsMs0c=g!L|#l^tD!0YMZ5(K0jK$wFKNUq8(yth&D0W+6@MTn7sm5GIw z@nmim8)R-EOPY$AX_BRxnYo3orIE3TuCalMk*-COsex{Cnvs!Znz^Z&VT$?W+bpgs zW@bsLW=3h2x)zB>X1a!ksg}A)iH2#qmc|CACdQUYW(Fpfn_XC&Syar7(~`{04U%=! zQqzoeO)X4JbQ4Vt40R2ROj3=Kjg3uA(kv$%ayT*rowQk>%ZQmcM?iH<*5^7ic`9Ec zan@Mzd#D(iCmI=>CmZ5*`7(ZCRwgr(&AUZb=(GGhy3kcwMxW^c?r zY#`uzQbBu%&;!Lu=Y%UJg{(7n$qJ8D(zI>dox;Jm%7!J_CEbHXW70B>S=V--YT)Jg z@&Eq*`t)e&FBj1v$@IQw0VfO@H<=NHs^Yq2XSQ$ zHU+LWrfa>}?e zGVt%{pV$AkRwN*barfE(W@58Af+ycg;C5jQt!g-1k#X~kH zz3$%mvo>5O9x(1ozjegmZE@x7%9DSZo#Ll0YEb&l5PqrnF8dMXefyWq+$@=Y`{nEW pS7!xTKkRqBmIw({hKSt1ybP9e_gL8-RxkyLdAjGDt70I>rH8<4E-D_yry@gXypWr&fnm4UgH zk@;jE78_)45KF3xg+Z!uqCsM+u9-=)k#1U|iG?l@o9Lz*C0ZD!n5Cp8Tc%FF&El$( znqrZbW@u=lYmsDNq-$uHY6(=BWTu;Jk!p~VXlh`QYM#2;g|(SQIVH)+Ak`!}Ro6Hr zDN)xv(ZonM$+6hjVcWG@(Sot`|EuTg~v zI}J8l@z=9585?chEwVzN<@&#_EtAt-^y|evT^vIyZoQdtkoS-Qk8AD`t~pAj96Jmd zCl@3MO>5MwYF1SGdPVWjLY9jfnU_q0=DzxUDeTq5{qeUqo<1fKWn8wU$bo?c9UZXy z=5#yw-KP^SF3+0_*e$lmMt_nx*iszlKCjQxzUN_;k?O V%kq7Z3@|k@c)I$ztaD0e0sw_V=Q98R delta 716 zcmX@q&A6(EQL!_?&z+Y`ii?4Pf!EW+B?w46fG`IekX)5ncyFWPLuM|E5F=G+j$eb0b|7GZPcbMDvuCl+={Tw^>|y zQ_M^)EQ}LVbuAK&(kA!wOKx^!ZDdigOfybSO0r1OHBU)3)iq86>bEd6Hq|w-NH#V$ zPf1L+v@n@$$YIA0b;D)@E<&F*?{Zxse8VyzOmHbVY&=cXP5ID zZX=;JiU&4j>)$f(RXr_s>G%AH=hqlqi#oaUp2}w?VCZ586Tx5r0uC!E`@+o=i z{q6HZRUPL#2vmJzJ)O4U@MISA`OM3z8dkk4`@Zu2?ytXtv-Mv*Wxj87AoxLKWc|8N z-rXuQy!d9U&Uo{ZkA2BD{s_aryk+&<&uuSr`(Y)<#-4MLabeKH^}+=X8TG2m=Y97s zK5%32`Cx^sat7g*_t*6^2NfSkyzZC$&c|Tchp4C4!3umgQuqQ|?d`f0|DW6R^f!p|)mqsk-_CZG^RHYk vvVPV7?fdubc9S_!-8@qq5>g7!#dq;DFx5=!H(mK82_)v}>gTe~DWM4fDq#q_ diff --git a/Assets/Sprites/Walls/bman_sprite_snowmound_v01.png.meta b/Assets/Sprites/Walls/snowball.png.meta similarity index 95% rename from Assets/Sprites/Walls/bman_sprite_snowmound_v01.png.meta rename to Assets/Sprites/Walls/snowball.png.meta index 24a9086..94f7310 100644 --- a/Assets/Sprites/Walls/bman_sprite_snowmound_v01.png.meta +++ b/Assets/Sprites/Walls/snowball.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2c89c5592e07249fd8d1f49c0e5a125e +guid: 5cd4487071acb46548e9bfad30835e56 TextureImporter: fileIDToRecycleName: {} externalObjects: {} @@ -45,7 +45,7 @@ TextureImporter: spriteMeshType: 1 alignment: 6 spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 64 + spritePixelsToUnits: 32 spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: a52906a715291443bb83ed96d864bcf6 + spriteID: 13003cd44618d494f98942f809733583 vertices: [] indices: edges: [] From c38050c9e4cf7b940a39a722a19c70b2138b8432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Sun, 16 Jun 2019 13:00:14 +0300 Subject: [PATCH 2/3] Import high_snow_prefab --- ...estructible_wall2.prefab => destructible_high_snow.prefab} | 4 ++-- ...e_wall2.prefab.meta => destructible_high_snow.prefab.meta} | 0 ...man_destructible_wall1.prefab => destructible_snow.prefab} | 2 +- ...ctible_wall1.prefab.meta => destructible_snow.prefab.meta} | 0 ...ndestructible_wall1.prefab => indestructible_crate.prefab} | 4 ++-- ...ble_wall1.prefab.meta => indestructible_crate.prefab.meta} | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename Assets/Prefabs/Walls/{bman_destructible_wall2.prefab => destructible_high_snow.prefab} (99%) rename Assets/Prefabs/Walls/{bman_destructible_wall2.prefab.meta => destructible_high_snow.prefab.meta} (100%) rename Assets/Prefabs/Walls/{bman_destructible_wall1.prefab => destructible_snow.prefab} (99%) rename Assets/Prefabs/Walls/{bman_destructible_wall1.prefab.meta => destructible_snow.prefab.meta} (100%) rename Assets/Prefabs/Walls/{bman_indestructible_wall1.prefab => indestructible_crate.prefab} (98%) rename Assets/Prefabs/Walls/{bman_indestructible_wall1.prefab.meta => indestructible_crate.prefab.meta} (100%) diff --git a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab b/Assets/Prefabs/Walls/destructible_high_snow.prefab similarity index 99% rename from Assets/Prefabs/Walls/bman_destructible_wall2.prefab rename to Assets/Prefabs/Walls/destructible_high_snow.prefab index cb81a74..801cc1c 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab +++ b/Assets/Prefabs/Walls/destructible_high_snow.prefab @@ -67,7 +67,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: 10 m_Sprite: {fileID: 21300000, guid: 9bb63e2c621a54be6ae6b541b4499c19, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -93,7 +93,7 @@ GameObject: - component: {fileID: 3937551180478767488} - component: {fileID: 2850266447828806432} m_Layer: 8 - m_Name: bman_destructible_wall2 + m_Name: destructible_high_snow m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab.meta b/Assets/Prefabs/Walls/destructible_high_snow.prefab.meta similarity index 100% rename from Assets/Prefabs/Walls/bman_destructible_wall2.prefab.meta rename to Assets/Prefabs/Walls/destructible_high_snow.prefab.meta diff --git a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab b/Assets/Prefabs/Walls/destructible_snow.prefab similarity index 99% rename from Assets/Prefabs/Walls/bman_destructible_wall1.prefab rename to Assets/Prefabs/Walls/destructible_snow.prefab index da3badb..eeaeb71 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab +++ b/Assets/Prefabs/Walls/destructible_snow.prefab @@ -177,7 +177,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: 10 m_Sprite: {fileID: 21300000, guid: 5cd4487071acb46548e9bfad30835e56, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab.meta b/Assets/Prefabs/Walls/destructible_snow.prefab.meta similarity index 100% rename from Assets/Prefabs/Walls/bman_destructible_wall1.prefab.meta rename to Assets/Prefabs/Walls/destructible_snow.prefab.meta diff --git a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab b/Assets/Prefabs/Walls/indestructible_crate.prefab similarity index 98% rename from Assets/Prefabs/Walls/bman_indestructible_wall1.prefab rename to Assets/Prefabs/Walls/indestructible_crate.prefab index 68273d2..357e2bc 100644 --- a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab +++ b/Assets/Prefabs/Walls/indestructible_crate.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 7808374684255412738} - component: {fileID: 9150705305556807559} m_Layer: 8 - m_Name: bman_indestructible_wall1 + m_Name: indestructible_crate m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -160,7 +160,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 0 + m_SortingOrder: 10 m_Sprite: {fileID: 21300000, guid: e6da7612beba841f6a44ea1c453f4b11, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 diff --git a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab.meta b/Assets/Prefabs/Walls/indestructible_crate.prefab.meta similarity index 100% rename from Assets/Prefabs/Walls/bman_indestructible_wall1.prefab.meta rename to Assets/Prefabs/Walls/indestructible_crate.prefab.meta From 9417167b9ecb78b84588f896afc92f29de129de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Sun, 16 Jun 2019 13:28:28 +0300 Subject: [PATCH 3/3] Improve Player Movement and animation state machine --- .../PlayerAnimationControllerV2.controller | 495 ++++++++++++++++++ ...layerAnimationControllerV2.controller.meta | 8 + Assets/Scenes/SampleScene.unity | 4 + .../Scripts/src/Helpers/Vector2Extensions.cs | 25 + .../src/Helpers/Vector2Extensions.cs.meta | 3 + Assets/Scripts/src/Player/PlayerController.cs | 11 +- 6 files changed, 541 insertions(+), 5 deletions(-) create mode 100644 Assets/Animations/Player/PlayerAnimationControllerV2.controller create mode 100644 Assets/Animations/Player/PlayerAnimationControllerV2.controller.meta create mode 100644 Assets/Scripts/src/Helpers/Vector2Extensions.cs create mode 100644 Assets/Scripts/src/Helpers/Vector2Extensions.cs.meta diff --git a/Assets/Animations/Player/PlayerAnimationControllerV2.controller b/Assets/Animations/Player/PlayerAnimationControllerV2.controller new file mode 100644 index 0000000..922074e --- /dev/null +++ b/Assets/Animations/Player/PlayerAnimationControllerV2.controller @@ -0,0 +1,495 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerAnimationControllerV2 + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: AnimVertical + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: AnimHorizontal + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107337773470424596} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &1101143220421918298 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: AnimVertical + m_EventTreshold: 0.5 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102161050045560226} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 0 +--- !u!1101 &1101231070825147440 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 4 + m_ConditionEvent: AnimVertical + m_EventTreshold: -0.5 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102484324358587624} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 0 +--- !u!1101 &1101317931981451248 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 4 + m_ConditionEvent: AnimHorizontal + m_EventTreshold: -0.5 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102090544316477732} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 0 +--- !u!1101 &1101587889080835818 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 4 + m_ConditionEvent: AnimHorizontal + m_EventTreshold: 0.1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102742770632451362} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.625 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101767725236551198 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: AnimVertical + m_EventTreshold: -0.1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102762913524167192} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.625 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101796395514785804 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: AnimHorizontal + m_EventTreshold: 0.5 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102040734548923532} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 0 +--- !u!1101 &1101891324128574020 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 3 + m_ConditionEvent: AnimHorizontal + m_EventTreshold: -0.1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102448146778981770} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.625 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1101 &1101955691907753134 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 4 + m_ConditionEvent: AnimVertical + m_EventTreshold: 0.1 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102240260109728614} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.625 + m_HasExitTime: 0 + m_HasFixedDuration: 0 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &1102040734548923532 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerRunRight + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101587889080835818} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 96df1e786c8d74c8f98e0ba167ee5a80, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102090544316477732 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerRunLeft + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101891324128574020} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 8de583040b3af46e9ab707c87ae51e79, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102161050045560226 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerRunUp + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101955691907753134} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 5cfba2509014e441a812fd5493deaaca, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102240260109728614 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerIdleUp + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 19dc6e34d6d9047d99b6de00eb5a0a82, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102448146778981770 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerIdleLeft + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 6a6539bed18954b148bf9d104ba5d99b, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102484324358587624 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerRunDown + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 1101767725236551198} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 2337addfd1df04b75a2f6e9b66367f34, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102742770632451362 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerIdleRight + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 832b860e387b44ff3ace50d911b69420, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1102 &1102762913524167192 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PlayerIdleDown + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: b7a9ce2fb18da4647af9b13ba8d28017, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1107 &1107337773470424596 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102762913524167192} + m_Position: {x: 240, y: 252, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102448146778981770} + m_Position: {x: 468, y: -12, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102742770632451362} + m_Position: {x: 468, y: 60, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102240260109728614} + m_Position: {x: 468, y: 132, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102484324358587624} + m_Position: {x: 240, y: 192, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102090544316477732} + m_Position: {x: 240, y: -12, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102040734548923532} + m_Position: {x: 240, y: 60, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102161050045560226} + m_Position: {x: 240, y: 120, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: 1101231070825147440} + - {fileID: 1101143220421918298} + - {fileID: 1101796395514785804} + - {fileID: 1101317931981451248} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102762913524167192} diff --git a/Assets/Animations/Player/PlayerAnimationControllerV2.controller.meta b/Assets/Animations/Player/PlayerAnimationControllerV2.controller.meta new file mode 100644 index 0000000..f83121f --- /dev/null +++ b/Assets/Animations/Player/PlayerAnimationControllerV2.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: de05f1f1430ea4aae8192fc639ee6a2c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 3b81639..48a7f68 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -8503,5 +8503,9 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1778702658, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} + propertyPath: m_Controller + value: + objectReference: {fileID: 9100000, guid: de05f1f1430ea4aae8192fc639ee6a2c, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} diff --git a/Assets/Scripts/src/Helpers/Vector2Extensions.cs b/Assets/Scripts/src/Helpers/Vector2Extensions.cs new file mode 100644 index 0000000..2c7e8d3 --- /dev/null +++ b/Assets/Scripts/src/Helpers/Vector2Extensions.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace src.Helpers +{ + public static class Vector2Extensions + { + /* + * Normalizes a vector2 to maximum speed and allow only movement in one axis at a time. + */ + public static Vector2 NormalizeToCross(this Vector2 vector) + { + var x = Mathf.Round(vector.x); + var y = Mathf.Round(vector.y); + if (Mathf.Abs(y) > Mathf.Abs(x)) + { + x = 0; + } + else + { + y = 0; + } + return new Vector2(x, y); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Helpers/Vector2Extensions.cs.meta b/Assets/Scripts/src/Helpers/Vector2Extensions.cs.meta new file mode 100644 index 0000000..5aa07d8 --- /dev/null +++ b/Assets/Scripts/src/Helpers/Vector2Extensions.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 72a889b67bf7450283dbc482cfadc1c5 +timeCreated: 1560679913 \ No newline at end of file diff --git a/Assets/Scripts/src/Player/PlayerController.cs b/Assets/Scripts/src/Player/PlayerController.cs index f9bb23a..90a3a5a 100644 --- a/Assets/Scripts/src/Player/PlayerController.cs +++ b/Assets/Scripts/src/Player/PlayerController.cs @@ -37,13 +37,14 @@ namespace src.Player private void HandleMovement() { #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL - var horizontal = Input.GetAxis("Horizontal"); - var vertical = Input.GetAxis("Vertical"); + var horizontal = Input.GetAxisRaw("Horizontal"); + var vertical = Input.GetAxisRaw("Vertical"); + var movementVector = new Vector2(horizontal, vertical).NormalizeToCross(); + + _animator.SetFloat(AnimHorizontal, movementVector.x); + _animator.SetFloat(AnimVertical, movementVector.y); - _animator.SetFloat(AnimHorizontal, horizontal); - _animator.SetFloat(AnimVertical, vertical); - var movementVector = new Vector2(horizontal, vertical); rigidbody2d.MovePosition(rigidbody2d.position + movementSpeed * Time.deltaTime * movementVector); #elif UNITY_IOS || UNITY_ANDROID // Phone movement is not supported yet.