diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 4f25b88..7654eb3 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -1,5 +1,35 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &351275810583331071 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 169274211856709645} + m_Layer: 0 + m_Name: BuletExitPoint + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &169274211856709645 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 351275810583331071} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0.26300016, y: 0.61299956, z: -0.013000095} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9086299259537425155} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} --- !u!1 &681358948229890261 GameObject: m_ObjectHideFlags: 0 @@ -28,7 +58,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.5799999, z: 0.27} m_LocalScale: {x: 0.8, y: 0.2, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 981273033772084037} m_RootOrder: 0 @@ -83,6 +112,54 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &3104486771267849676 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1155604412711610141} + - component: {fileID: 902077785060134974} + m_Layer: 0 + m_Name: WeaponHolder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1155604412711610141 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3104486771267849676} + 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: + - {fileID: 9086299259537425155} + m_Father: {fileID: 6272346181657429396} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &902077785060134974 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3104486771267849676} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 98dadd30ba25ec34db3b45d0dca2827b, type: 3} + m_Name: + m_EditorClassIdentifier: + currentWeaponIndex: 0 + allWeapons: [] + activeWeapons: [] + cam: {fileID: 0} --- !u!1 &3649358604728444914 GameObject: m_ObjectHideFlags: 0 @@ -109,7 +186,6 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: -0.274, z: 0.7} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6272346181657429396} m_RootOrder: 0 @@ -142,7 +218,6 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6272346181302961296} m_RootOrder: 0 @@ -304,9 +379,10 @@ GameObject: - component: {fileID: 5630859218361338035} - component: {fileID: 8436279266335313624} - component: {fileID: 268368477457052331} - - component: {fileID: 3781802212159559521} - component: {fileID: 6207632454083444980} - component: {fileID: 1509131218531316230} + - component: {fileID: 8914029058295428365} + - component: {fileID: 4666987960863501143} m_Layer: 0 m_Name: Player m_TagString: Player @@ -324,7 +400,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 2.15, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: - {fileID: 5844730607706440515} - {fileID: 2458562619286483438} @@ -474,7 +549,6 @@ MonoBehaviour: maxCameraAngle: 90 neckStartAngle: 0 minCameraAngle: -90 - neckLength: 0.2 mouseSmoothTime: 0.001 lockCursor: 1 --- !u!114 &8436279266335313624 @@ -517,21 +591,6 @@ MonoBehaviour: stepAmplitudeSprinting: 0.07 stepFrequency: 0.8 Neck: {fileID: 6272346181657429396} ---- !u!114 &3781802212159559521 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6272346181302961293} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: bc5bc2b49bd326e4db460a6a3af59311, type: 3} - m_Name: - m_EditorClassIdentifier: - syncMode: 0 - syncInterval: 0.1 - muzzle: {fileID: 3649358604728444914} --- !u!114 &6207632454083444980 MonoBehaviour: m_ObjectHideFlags: 0 @@ -592,6 +651,34 @@ MonoBehaviour: showOverlay: 0 overlayColor: {r: 0, g: 0, b: 0, a: 0.5} target: {fileID: 981273033772084037} +--- !u!114 &8914029058295428365 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6272346181302961293} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 323a821a5fef23a45aa5333ce1f55202, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &4666987960863501143 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6272346181302961293} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0f43c52a1834dcb4bab807bc0cbddec2, type: 3} + m_Name: + m_EditorClassIdentifier: + syncMode: 0 + syncInterval: 0.1 + muzzle: {fileID: 351275810583331071} + weaponHolder: {fileID: 8454054357811321273} --- !u!1 &6272346181657429393 GameObject: m_ObjectHideFlags: 0 @@ -608,7 +695,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!4 &6272346181657429396 Transform: m_ObjectHideFlags: 0 @@ -619,9 +706,9 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 5021921342190399731} + - {fileID: 1155604412711610141} m_Father: {fileID: 981273033772084037} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -694,7 +781,6 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6272346181302961296} m_RootOrder: 2 @@ -725,13 +811,35 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 2.01, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: - {fileID: 4399039561386292163} - {fileID: 6272346181657429396} m_Father: {fileID: 6272346181302961296} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4862277589106201629 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8454054357811321273} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c98f5c47a8b7dd64f86fd6f42c4d6e5e, type: 3} + m_Name: + m_EditorClassIdentifier: + weaponKind: 1 + active: 0 + damage: 15 + firerate: 1 + roundsPerShot: 1 + recoilStrength: 15 + currentAmmunition: 12 + magazinSize: 12 + totalAmmunition: 24 + bulletExit: {fileID: 351275810583331071} + allowAction: 1 --- !u!1 &8690889598169456425 GameObject: m_ObjectHideFlags: 0 @@ -760,7 +868,6 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 1, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 6272346181302961296} m_RootOrder: 1 @@ -815,3 +922,82 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!1001 &8760552908600304872 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1155604412711610141} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalScale.x + value: 0.15 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalScale.y + value: 0.15 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalScale.z + value: 0.15 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalPosition.x + value: 0.27032673 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalPosition.y + value: -0.17900014 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalPosition.z + value: 0.77892053 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalRotation.w + value: 0.68995017 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalRotation.y + value: -0.7238569 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -92.748 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + propertyPath: m_Name + value: USP + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} +--- !u!4 &9086299259537425155 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + m_PrefabInstance: {fileID: 8760552908600304872} + m_PrefabAsset: {fileID: 0} +--- !u!1 &8454054357811321273 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: db8a9548ba56c1949bb28f7c6129bbeb, type: 3} + m_PrefabInstance: {fileID: 8760552908600304872} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scripts/Weapons/Reload.cs b/Assets/Scripts/Weapons/Reload.cs deleted file mode 100644 index 90ffdb2..0000000 --- a/Assets/Scripts/Weapons/Reload.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Mirror; -public class Reload : NetworkBehaviour -{ - - - // Update is called once per frame - void Update() - { - if (isLocalPlayer) - { - if (Input.GetButton("Reload")) - { - - } - } - } - - -} diff --git a/Assets/Scripts/Weapons/Reload.cs.meta b/Assets/Scripts/Weapons/Reload.cs.meta deleted file mode 100644 index 7870dd7..0000000 --- a/Assets/Scripts/Weapons/Reload.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9d6f405c993960a419018706eaaee8c8 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Weapons/Shoot.cs b/Assets/Scripts/Weapons/Shoot.cs index 0996a2e..3337cf5 100644 --- a/Assets/Scripts/Weapons/Shoot.cs +++ b/Assets/Scripts/Weapons/Shoot.cs @@ -10,9 +10,13 @@ public class Shoot : NetworkBehaviour private Weapon weapon; Ammunition ammunition; - + private RaycastHit crosshairHitPoint; + private Camera mCamera; + private Vector3 _pointDirection; + private Quaternion _lookRotation; private void Start() { + mCamera = Camera.main; weapon = weaponHolder.GetComponent(); } @@ -20,6 +24,7 @@ public class Shoot : NetworkBehaviour { if (isLocalPlayer) { + if (Input.GetButton("Fire")) { CmdFireBullet(); @@ -41,13 +46,23 @@ public class Shoot : NetworkBehaviour } } - [Command] + [Command] // This code will be executed on the Server. private void CmdFireBullet() { + Physics.Raycast(mCamera.transform.position, mCamera.transform.forward, out crosshairHitPoint); + Debug.DrawLine(mCamera.transform.position, crosshairHitPoint.point); + _pointDirection = crosshairHitPoint.point - muzzle.transform.position; + _lookRotation = Quaternion.LookRotation(_pointDirection); + weapon.transform.rotation = Quaternion.RotateTowards(weapon.transform.rotation, _lookRotation, 1f); + if (Physics.Raycast(muzzle.transform.position, muzzle.transform.forward, out RaycastHit hit) && weapon.CurrentAmmunition > 0) + { + Debug.DrawLine(muzzle.transform.position, hit.point); + } + if (weapon.AllowAction) { - if (Physics.Raycast(muzzle.transform.position, muzzle.transform.forward, out RaycastHit hit) && weapon.CurrentAmmunition > 0) + if (Physics.Raycast(muzzle.transform.position, muzzle.transform.forward, out hit) && weapon.CurrentAmmunition > 0) { Debug.DrawLine(muzzle.transform.position, hit.point); Debug.Log("Geshooted BITCH"); @@ -65,7 +80,7 @@ public class Shoot : NetworkBehaviour } } - + IEnumerator fireRate() { weapon.AllowAction = false; diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index b479120..c01782a 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -18,7 +18,7 @@ "url": "https://packages.unity.com" }, "com.unity.burst": { - "version": "1.6.0", + "version": "1.5.6", "depth": 1, "source": "registry", "dependencies": { @@ -69,7 +69,7 @@ "url": "https://packages.unity.com" }, "com.unity.mathematics": { - "version": "1.2.4", + "version": "1.2.1", "depth": 2, "source": "registry", "dependencies": {},