diff --git a/Assets/Prefabs/Weapon/Magic_Sword.prefab b/Assets/Prefabs/Weapon/Magic_Sword.prefab index 6dca15ae0adfd93304ee1eed4c65dae988242ac0..6457a8e7e94cdd2ae5bde4cc909c1a666e7d5aa3 100644 --- a/Assets/Prefabs/Weapon/Magic_Sword.prefab +++ b/Assets/Prefabs/Weapon/Magic_Sword.prefab @@ -300,8 +300,6 @@ GameObject: - component: {fileID: 5155366213496440859} - component: {fileID: 5541995270386721689} - component: {fileID: 8433524199888681593} - - component: {fileID: 4580664378243019515} - - component: {fileID: 3921152701017606813} m_Layer: 0 m_Name: Magic_Sword m_TagString: Untagged @@ -369,62 +367,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1ac8afea40b36cc42a2df62e3f44d957, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &4580664378243019515 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7188685860291963698} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: de1ce7b2da063c845bb32c30cd8cef70, type: 3} - m_Name: - m_EditorClassIdentifier: - gameEvent: {fileID: 11400000, guid: f3aafe63796c9934eab07af8124650ac, type: 2} - response: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 8433524199888681593} - m_TargetAssemblyTypeName: PlayerSword, Assembly-CSharp - m_MethodName: OnGameStart - m_Mode: 0 - 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 ---- !u!114 &3921152701017606813 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7188685860291963698} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: de1ce7b2da063c845bb32c30cd8cef70, type: 3} - m_Name: - m_EditorClassIdentifier: - gameEvent: {fileID: 11400000, guid: 71f331a66dec88845bad1b1e6116abeb, type: 2} - response: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 8433524199888681593} - m_TargetAssemblyTypeName: PlayerSword, Assembly-CSharp - m_MethodName: OnGameStop - m_Mode: 0 - 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 --- !u!1 &7448972893573913003 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Weapon/WeaponHolder.prefab b/Assets/Prefabs/Weapon/WeaponHolder.prefab index a98d9703f1905aa8d4007d8a3183041021a864c4..300c95378c0149e0456c4242d749a1fbabc5798c 100644 --- a/Assets/Prefabs/Weapon/WeaponHolder.prefab +++ b/Assets/Prefabs/Weapon/WeaponHolder.prefab @@ -5729,7 +5729,7 @@ Transform: m_Children: - {fileID: 6043717366125275497} - {fileID: 5468501167828867635} - - {fileID: 6554178630619007139} + - {fileID: 2636210687764954889} - {fileID: 6301138732281405787} - {fileID: 5085931142903557149} - {fileID: 1997992154694834955} @@ -6155,84 +6155,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 3472729103366541310, guid: 8ebe7a510907e4440a22485e3dfb9943, type: 3} m_PrefabInstance: {fileID: 7440994361372077733} m_PrefabAsset: {fileID: 0} ---- !u!1001 &7440994362202736963 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 1550041344122329040} - m_Modifications: - - target: {fileID: 136823498175365382, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_Name - value: Magic_Sword - objectReference: {fileID: 0} - - target: {fileID: 136823498175365382, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_IsActive - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalScale.x - value: 0.051170297 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalScale.y - value: 0.018918023 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalScale.z - value: 0.030803366 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalPosition.x - value: 0.6829999 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalPosition.y - value: 0.416 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalPosition.z - value: -0.055999994 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalRotation.w - value: 0.51075506 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalRotation.x - value: 0.6974858 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalRotation.y - value: -0.37705165 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalRotation.z - value: -0.33237788 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 27.506 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -106.864 - objectReference: {fileID: 0} - - target: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: -102.629 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 1931910b2abb13846a697db119d75b7d, type: 3} ---- !u!4 &6554178630619007139 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4446924544439468512, guid: 1931910b2abb13846a697db119d75b7d, type: 3} - m_PrefabInstance: {fileID: 7440994362202736963} - m_PrefabAsset: {fileID: 0} --- !u!1001 &7440994363083039082 PrefabInstance: m_ObjectHideFlags: 0 @@ -6311,3 +6233,65 @@ Transform: m_CorrespondingSourceObject: {fileID: 2438527259672530295, guid: 26b39247874858f4b810f01ae22bdd1b, type: 3} m_PrefabInstance: {fileID: 7440994363083039082} m_PrefabAsset: {fileID: 0} +--- !u!1001 &8864872302306563293 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1550041344122329040} + m_Modifications: + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalPosition.x + value: 0.476 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalPosition.y + value: 0.33 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalPosition.z + value: 0.493 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalRotation.w + value: 0.11950822 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalRotation.x + value: 0.6978869 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalRotation.y + value: -0.7006817 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalRotation.z + value: -0.08784596 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 2.505 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -163.12 + objectReference: {fileID: 0} + - target: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: -89.399 + objectReference: {fileID: 0} + - target: {fileID: 7188685860291963698, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + propertyPath: m_Name + value: Magic_Sword + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} +--- !u!4 &2636210687764954889 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6887105279771536340, guid: b10a5ff12fea4d840b0c1a2a7f7cdfc8, type: 3} + m_PrefabInstance: {fileID: 8864872302306563293} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scripts/Player/PlayerSword.cs b/Assets/Scripts/Player/PlayerSword.cs index e0296a81aa4898c861baa7a16d5f3eed35f9dd78..034ac2c351a2889c828bda5a4f8e8983ac4913ff 100644 --- a/Assets/Scripts/Player/PlayerSword.cs +++ b/Assets/Scripts/Player/PlayerSword.cs @@ -1,41 +1,39 @@ -using System.Collections; -using UnityEngine; -using UnityEngine.InputSystem; - -public class PlayerSword : MonoBehaviour -{ - public static int baseDamagePerTouch = 50; - public static int damagePerTouch = 50; - public InputControl playerControls; - private InputAction fire; - private bool isPlayed; - Animator anim; - - - private void Clicked(InputAction.CallbackContext context) - { - if (isPlayed) - { - if (context.performed) - { - anim.SetBool("IsSwing", true); - } - else if (context.canceled) - { - anim.SetBool("IsSwing", false); - } - } - - - } - - private void OnEnable() - { - fire = playerControls.Player.Fire; - fire.Enable(); - fire.performed += Clicked; - fire.canceled += Clicked; - +using System.Collections; +using UnityEngine; +using UnityEngine.InputSystem; + +public class PlayerSword : MonoBehaviour +{ + public static int baseDamagePerTouch = 50; + public static int damagePerTouch = 50; + public InputControl playerControls; + private InputAction fire; + Animator anim; + + + private void Clicked(InputAction.CallbackContext context) + { + { + if (context.performed) + { + anim.SetBool("IsSwing", true); + } + else if (context.canceled) + { + anim.SetBool("IsSwing", false); + } + } + + + } + + private void OnEnable() + { + fire = playerControls.Player.Fire; + fire.Enable(); + fire.performed += Clicked; + fire.canceled += Clicked; + } static public void upgrade() @@ -45,51 +43,40 @@ public class PlayerSword : MonoBehaviour } - private void OnDisable() - { - fire.Disable(); - } - - void Awake() - { - playerControls = new InputControl(); - isPlayed = false; - anim = GetComponent<Animator>(); - } - - public void buffDamage(float damageMultiplier) - { - damagePerTouch = (int)(damageMultiplier * baseDamagePerTouch); - } - - public void removeBuff() - { - damagePerTouch = baseDamagePerTouch; - } - - public void OnGameStop(Component sender, object data) - { - isPlayed = false; - } - - public void OnGameStart(Component sender, object data) - { - isPlayed = true; - } - - void OnTriggerEnter(Collider other) - { - if (other.CompareTag("Enemy")) - { - if (fire.ReadValue<float>() == 1) - { - EnemyHealth enemyHealth = other.gameObject.GetComponent<EnemyHealth>(); - if (enemyHealth != null) - { - enemyHealth.TakeDamage(damagePerTouch, transform.position); - } - } - - } - } -} + private void OnDisable() + { + fire.Disable(); + } + + void Awake() + { + playerControls = new InputControl(); + anim = GetComponent<Animator>(); + } + + public void buffDamage(float damageMultiplier) + { + damagePerTouch = (int)(damageMultiplier * baseDamagePerTouch); + } + + public void removeBuff() + { + damagePerTouch = baseDamagePerTouch; + } + + void OnTriggerEnter(Collider other) + { + if (other.CompareTag("Enemy")) + { + if (fire.ReadValue<float>() == 1) + { + EnemyHealth enemyHealth = other.gameObject.GetComponent<EnemyHealth>(); + if (enemyHealth != null) + { + enemyHealth.TakeDamage(damagePerTouch, transform.position); + } + } + + } + } +}