diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 6eae18f..fef4114 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -1,5 +1,95 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &63373710747700875 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3118287694834230934} + m_Layer: 0 + m_Name: HandMiddle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3118287694834230934 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 63373710747700875} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.45, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8489029732530782807} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &590584242949539293 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1270933798917005542} + m_Layer: 0 + m_Name: HandRight + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1270933798917005542 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 590584242949539293} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.15, y: 0.45, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8489029732530782807} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2055525761678926607 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6758694282293649363} + m_Layer: 0 + m_Name: HandLeft + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6758694282293649363 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2055525761678926607} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.15, y: 0.45, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8489029732530782807} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &4843835016145658905 GameObject: m_ObjectHideFlags: 0 @@ -104,13 +194,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6162977751205541769} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.147, y: 0.441, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -0.15, y: 0.45, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 3236373932878825813} m_Father: {fileID: 8489029732530782807} - m_RootOrder: 2 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &8489029732241002798 GameObject: @@ -245,6 +335,9 @@ Transform: m_Children: - {fileID: 8489029732599905345} - {fileID: 8489029732241002785} + - {fileID: 6758694282293649363} + - {fileID: 1270933798917005542} + - {fileID: 3118287694834230934} - {fileID: 8334477035414792174} m_Father: {fileID: 0} m_RootOrder: 0 @@ -261,7 +354,7 @@ Rigidbody2D: m_Simulated: 1 m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 - m_Mass: 10 + m_Mass: 0.0001 m_LinearDrag: 0 m_AngularDrag: 0 m_GravityScale: 0 @@ -315,6 +408,9 @@ MonoBehaviour: BodyAnim: {fileID: 7470056256336689202} HeadSprite: {fileID: 8489029732599905344} HeadAnim: {fileID: 4393298056784288995} + HandLeft: {fileID: 6758694282293649363} + HandRight: {fileID: 1270933798917005542} + HandMiddle: {fileID: 3118287694834230934} --- !u!1 &8489029732599905358 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 1f2d62a..15159e7 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -15,6 +15,10 @@ namespace Saltosion.OneWeapon { public SpriteRenderer HeadSprite; public Animator HeadAnim; + public Transform HandLeft; + public Transform HandRight; + public Transform HandMiddle; + private Gun Gun; private Vector2 GunLocation = new Vector2(0, -0.6f); @@ -48,16 +52,20 @@ namespace Saltosion.OneWeapon { BodySprite.flipX = false; HeadAnim.Play("HeadRight"); HeadSprite.flipX = false; + Hand.localPosition = HandMiddle.localPosition; } else if (Rotation >= 225 || Rotation < -45) { BodyAnim.Play("HorizontalBody"); BodySprite.flipX = true; HeadAnim.Play("HeadRight"); HeadSprite.flipX = true; + Hand.localPosition = HandMiddle.localPosition; } else { if (Rotation >= 135 && Rotation < 225) { HeadAnim.Play("HeadUp"); + Hand.localPosition = HandRight.localPosition; } else { HeadAnim.Play("HeadDown"); + Hand.localPosition = HandLeft.localPosition; } BodyAnim.Play("VerticalBody"); BodySprite.flipX = false;