From 8ea5bc896eaca40f1d6ce17c94ce112f15c88fd9 Mon Sep 17 00:00:00 2001 From: KOSMOGOR Date: Mon, 10 Mar 2025 10:23:51 +0300 Subject: [PATCH 1/3] update: player prefab and Composing scene update: Pistol shoots bullets with spawnPosition rotation --- Assets/Prefabs/Bullet.prefab | 3 +- Assets/Prefabs/Player.prefab | 157 ++++++++++++++- Assets/Scenes/Composing.unity | 368 +--------------------------------- Assets/Scripts/Pistol.cs | 2 +- 4 files changed, 157 insertions(+), 373 deletions(-) diff --git a/Assets/Prefabs/Bullet.prefab b/Assets/Prefabs/Bullet.prefab index af47b91..15e2746 100644 --- a/Assets/Prefabs/Bullet.prefab +++ b/Assets/Prefabs/Bullet.prefab @@ -149,5 +149,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e7a451ad0b53e8c0ca82f7ce15114c38, type: 3} m_Name: m_EditorClassIdentifier: - speed: 1 + speed: 5 damage: 20 + timeToLive: 5 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index e3d66e3..f85e46d 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -62,7 +62,9 @@ Transform: m_LocalPosition: {x: 0, y: 0.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [] + m_Children: + - {fileID: 6673119647171785291} + - {fileID: 1643315469074404677} m_Father: {fileID: 6890030909251295590} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &1094126809165627842 @@ -147,8 +149,8 @@ MonoBehaviour: m_Bits: 1 m_VolumeTrigger: {fileID: 0} m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 0 - m_Antialiasing: 0 + m_RenderPostProcessing: 1 + m_Antialiasing: 1 m_AntialiasingQuality: 2 m_StopNaN: 0 m_Dithering: 0 @@ -168,6 +170,37 @@ MonoBehaviour: m_MipBias: 0 m_VarianceClampScale: 0.9 m_ContrastAdaptiveSharpening: 0 +--- !u!1 &8550168148493531477 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1643315469074404677} + m_Layer: 0 + m_Name: Muzzle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1643315469074404677 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8550168148493531477} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.5, y: -0.3, z: 1.8} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4506534449155536579} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &9016311960615966999 GameObject: m_ObjectHideFlags: 0 @@ -182,6 +215,7 @@ GameObject: - component: {fileID: 1437407097293080706} - component: {fileID: 397169322893853401} - component: {fileID: 1198108720433238150} + - component: {fileID: 3263211181679880648} m_Layer: 0 m_Name: Player m_TagString: Untagged @@ -198,7 +232,7 @@ Transform: m_GameObject: {fileID: 9016311960615966999} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 2, z: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -326,3 +360,118 @@ MonoBehaviour: verSpeed: 200 verUpperBound: 90 verLowerBound: -90 +--- !u!114 &3263211181679880648 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9016311960615966999} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f3724861d6ef4a112910a3ef14207757, type: 3} + m_Name: + m_EditorClassIdentifier: + weapons: [] + currentWeapon: 0 +--- !u!1001 &5007862695471124980 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 4506534449155536579} + m_Modifications: + - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: 'm_Materials.Array.data[0]' + value: + objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} + - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: 'm_Materials.Array.data[1]' + value: + objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} + - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: 'm_Materials.Array.data[2]' + value: + objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} + - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: 'm_Materials.Array.data[3]' + value: + objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} + - target: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_Name + value: Pistol_0.1 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalPosition.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalPosition.y + value: -0.5 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalPosition.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalRotation.w + value: 0.06162845 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalRotation.x + value: -0.70441604 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalRotation.y + value: -0.70441604 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalRotation.z + value: -0.06162845 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -10 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -180 + objectReference: {fileID: 0} + - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 90 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + insertIndex: -1 + addedObject: {fileID: 8320176447420130494} + m_SourcePrefab: {fileID: 100100000, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} +--- !u!1 &6327696402472954097 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + m_PrefabInstance: {fileID: 5007862695471124980} + m_PrefabAsset: {fileID: 0} +--- !u!114 &8320176447420130494 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6327696402472954097} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9b5e56940d7855caeb2d584265db0624, type: 3} + m_Name: + m_EditorClassIdentifier: + projectilePrefab: {fileID: 1562924000103655330, guid: bfe7100930f24fd52b5b66832f59cfa8, type: 3} + spawnPosition: {fileID: 1643315469074404677} + fireRate: 1 +--- !u!4 &6673119647171785291 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} + m_PrefabInstance: {fileID: 5007862695471124980} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scenes/Composing.unity b/Assets/Scenes/Composing.unity index 1a5133c..e151425 100644 --- a/Assets/Scenes/Composing.unity +++ b/Assets/Scenes/Composing.unity @@ -124,11 +124,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 4357511284367880818, guid: 73c9d3d3ea6065747956699e5d1f5392, type: 3} m_PrefabInstance: {fileID: 1168105054} m_PrefabAsset: {fileID: 0} ---- !u!4 &99598608 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 4506534449155536579, guid: 53e225dcb536a6f46b5844bb8db07fe4, type: 3} - m_PrefabInstance: {fileID: 3997104640432974468} - m_PrefabAsset: {fileID: 0} --- !u!4 &244018640 stripped Transform: m_CorrespondingSourceObject: {fileID: 6025933111829980118, guid: ca28c894d7e3a8e4d8feb70b9a8bb1c4, type: 3} @@ -354,124 +349,6 @@ Transform: - {fileID: 1690414898} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &700479631 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalPosition.x - value: 14.779945 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalPosition.y - value: -0.0000076293945 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalPosition.z - value: 99.28143 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalRotation.w - value: -0.7071067 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalRotation.x - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 919132149155446097, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} - propertyPath: m_Name - value: Lava_Area_Light - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 6138e5e208ffca64f8e03f475c1a904a, type: 3} ---- !u!1001 &792221756 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalPosition.x - value: 14.779945 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalPosition.y - value: -0.0000076293945 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalPosition.z - value: 99.28143 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalRotation.x - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 919132149155446097, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_Name - value: Ceiling_Area_Light_1 - objectReference: {fileID: 0} - - target: {fileID: 4935003872567433204, guid: 4b5486799c646a640a580e1c6831d332, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 4b5486799c646a640a580e1c6831d332, type: 3} --- !u!4 &814580603 stripped Transform: m_CorrespondingSourceObject: {fileID: 6025933111829980118, guid: ca28c894d7e3a8e4d8feb70b9a8bb1c4, type: 3} @@ -593,11 +470,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 795996269680244239, guid: 5157f3098ce9b0d4282980ecd17a9ec3, type: 3} m_PrefabInstance: {fileID: 1341570327} m_PrefabAsset: {fileID: 0} ---- !u!4 &1126042470 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - m_PrefabInstance: {fileID: 2159189467885668185} - m_PrefabAsset: {fileID: 0} --- !u!1001 &1168105054 PrefabInstance: m_ObjectHideFlags: 0 @@ -722,107 +594,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 6025933111829980118, guid: ca28c894d7e3a8e4d8feb70b9a8bb1c4, type: 3} m_PrefabInstance: {fileID: 1903976060} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1555151540 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -7853120362946791194, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: -6367444929722157375, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: -4976235030035833125, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: -3143558483194166149, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: -662909361366826300, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 919132149155446097, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Name - value: Level1_0.1 - objectReference: {fileID: 0} - - target: {fileID: 919132149155446097, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_IsActive - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 2818826380887570562, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 5733911823876726600, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 5856117470861584492, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 8345129058921690494, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 8613709593378099745, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} - propertyPath: m_Lightmapping - value: 2 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: b7eb279b00f6fbf4bb09461381196875, type: 3} --- !u!1 &1560783767 GameObject: m_ObjectHideFlags: 0 @@ -1006,63 +777,6 @@ Transform: m_CorrespondingSourceObject: {fileID: 795996269680244239, guid: 5157f3098ce9b0d4282980ecd17a9ec3, type: 3} m_PrefabInstance: {fileID: 823861237} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1733140263 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalPosition.x - value: 14.779945 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalPosition.y - value: -0.0000076293945 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalPosition.z - value: 99.28143 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalRotation.w - value: -0.061628412 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalRotation.x - value: -0.0616285 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalRotation.y - value: 0.704416 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalRotation.z - value: 0.7044161 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 919132149155446097, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} - propertyPath: m_Name - value: Spot_Light_1 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 8b691628bb5135f44ae31e89e436113a, type: 3} --- !u!1001 &1777178255 PrefabInstance: m_ObjectHideFlags: 0 @@ -1467,79 +1181,6 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0a6d9f24857a5d742b9df2df7da4a192, type: 3} ---- !u!1001 &2159189467885668185 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 99598608} - m_Modifications: - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: 'm_Materials.Array.data[0]' - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: 'm_Materials.Array.data[1]' - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: 'm_Materials.Array.data[2]' - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: 'm_Materials.Array.data[3]' - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_Name - value: Pistol_0.1 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalPosition.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalPosition.y - value: -0.5 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalPosition.z - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.w - value: 0.06162845 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.x - value: -0.70441604 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.y - value: -0.70441604 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.z - value: -0.06162845 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -10 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -180 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 90 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} --- !u!1001 &2657052385640200812 PrefabInstance: m_ObjectHideFlags: 0 @@ -1659,10 +1300,7 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] - m_AddedGameObjects: - - targetCorrespondingSourceObject: {fileID: 4506534449155536579, guid: 53e225dcb536a6f46b5844bb8db07fe4, type: 3} - insertIndex: -1 - addedObject: {fileID: 1126042470} + m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 53e225dcb536a6f46b5844bb8db07fe4, type: 3} --- !u!1001 &6825853474636966005 @@ -1789,10 +1427,6 @@ SceneRoots: m_Roots: - {fileID: 1560783769} - {fileID: 3997104640432974468} - - {fileID: 1555151540} - {fileID: 840308438} - - {fileID: 1733140263} - - {fileID: 700479631} - - {fileID: 792221756} - {fileID: 690075884} - {fileID: 219120118920238392} diff --git a/Assets/Scripts/Pistol.cs b/Assets/Scripts/Pistol.cs index e02287f..d11503a 100644 --- a/Assets/Scripts/Pistol.cs +++ b/Assets/Scripts/Pistol.cs @@ -10,7 +10,7 @@ public class Pistol : Weapon public override void Shoot(bool keyDown, bool keyHold) { if (keyDown && (fireRate == 0 || currentDelay == 1 / fireRate)) { - Instantiate(projectilePrefab, spawnPosition.position, transform.rotation); + Instantiate(projectilePrefab, spawnPosition.position, spawnPosition.rotation); currentDelay = 0; } } From 2869bfdb33f0d5063f10c248630034bcb0423601 Mon Sep 17 00:00:00 2001 From: KOSMOGOR Date: Mon, 17 Mar 2025 15:28:10 +0300 Subject: [PATCH 2/3] add: Level and Game controllers base update: scripts are now in folders --- Assets/Prefabs/GameController.prefab | 49 +++++++++++++++++++ Assets/Prefabs/GameController.prefab.meta | 7 +++ Assets/Prefabs/LevelController.prefab | 47 ++++++++++++++++++ Assets/Prefabs/LevelController.prefab.meta | 7 +++ Assets/Scenes/Composing.unity | 5 +- Assets/Scripts/Enemies.meta | 8 +++ Assets/Scripts/{ => Enemies}/Enemy.cs | 0 Assets/Scripts/{ => Enemies}/Enemy.cs.meta | 0 Assets/Scripts/Game.meta | 8 +++ Assets/Scripts/Game/GameController.cs | 22 +++++++++ Assets/Scripts/Game/GameController.cs.meta | 2 + Assets/Scripts/Game/LevelController.cs | 8 +++ Assets/Scripts/Game/LevelController.cs.meta | 2 + Assets/Scripts/Player.meta | 8 +++ .../Scripts/{ => Player}/BulletProjectile.cs | 0 .../{ => Player}/BulletProjectile.cs.meta | 0 Assets/Scripts/{ => Player}/CameraMovement.cs | 0 .../{ => Player}/CameraMovement.cs.meta | 0 Assets/Scripts/{ => Player}/Pistol.cs | 0 Assets/Scripts/{ => Player}/Pistol.cs.meta | 0 Assets/Scripts/{ => Player}/PlayerMovement.cs | 0 .../{ => Player}/PlayerMovement.cs.meta | 0 Assets/Scripts/{ => Player}/Weapon.cs | 0 Assets/Scripts/{ => Player}/Weapon.cs.meta | 0 .../Scripts/{ => Player}/WeaponController.cs | 0 .../{ => Player}/WeaponController.cs.meta | 0 26 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 Assets/Prefabs/GameController.prefab create mode 100644 Assets/Prefabs/GameController.prefab.meta create mode 100644 Assets/Prefabs/LevelController.prefab create mode 100644 Assets/Prefabs/LevelController.prefab.meta create mode 100644 Assets/Scripts/Enemies.meta rename Assets/Scripts/{ => Enemies}/Enemy.cs (100%) rename Assets/Scripts/{ => Enemies}/Enemy.cs.meta (100%) create mode 100644 Assets/Scripts/Game.meta create mode 100644 Assets/Scripts/Game/GameController.cs create mode 100644 Assets/Scripts/Game/GameController.cs.meta create mode 100644 Assets/Scripts/Game/LevelController.cs create mode 100644 Assets/Scripts/Game/LevelController.cs.meta create mode 100644 Assets/Scripts/Player.meta rename Assets/Scripts/{ => Player}/BulletProjectile.cs (100%) rename Assets/Scripts/{ => Player}/BulletProjectile.cs.meta (100%) rename Assets/Scripts/{ => Player}/CameraMovement.cs (100%) rename Assets/Scripts/{ => Player}/CameraMovement.cs.meta (100%) rename Assets/Scripts/{ => Player}/Pistol.cs (100%) rename Assets/Scripts/{ => Player}/Pistol.cs.meta (100%) rename Assets/Scripts/{ => Player}/PlayerMovement.cs (100%) rename Assets/Scripts/{ => Player}/PlayerMovement.cs.meta (100%) rename Assets/Scripts/{ => Player}/Weapon.cs (100%) rename Assets/Scripts/{ => Player}/Weapon.cs.meta (100%) rename Assets/Scripts/{ => Player}/WeaponController.cs (100%) rename Assets/Scripts/{ => Player}/WeaponController.cs.meta (100%) diff --git a/Assets/Prefabs/GameController.prefab b/Assets/Prefabs/GameController.prefab new file mode 100644 index 0000000..45735c3 --- /dev/null +++ b/Assets/Prefabs/GameController.prefab @@ -0,0 +1,49 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8523789084967070956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4174800862365466133} + - component: {fileID: 516178593971919101} + m_Layer: 0 + m_Name: GameController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4174800862365466133 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8523789084967070956} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &516178593971919101 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8523789084967070956} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 21512d898f67c404d9a7519c0b7dcba8, type: 3} + m_Name: + m_EditorClassIdentifier: + levels: + - scene: {fileID: 102900000, guid: 6a72d2724c840fd47aab3aea136d312f, type: 3} + enemies: [] diff --git a/Assets/Prefabs/GameController.prefab.meta b/Assets/Prefabs/GameController.prefab.meta new file mode 100644 index 0000000..ef2c120 --- /dev/null +++ b/Assets/Prefabs/GameController.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c70b322607b9da64382c966f9fdf41b1 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/LevelController.prefab b/Assets/Prefabs/LevelController.prefab new file mode 100644 index 0000000..1502cee --- /dev/null +++ b/Assets/Prefabs/LevelController.prefab @@ -0,0 +1,47 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8523789084967070956 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4174800862365466133} + - component: {fileID: 626889921843831083} + m_Layer: 0 + m_Name: LevelController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4174800862365466133 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8523789084967070956} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &626889921843831083 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8523789084967070956} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67f50dd8d32d83d4891b1a18fd12ec38, type: 3} + m_Name: + m_EditorClassIdentifier: + enemies: [] diff --git a/Assets/Prefabs/LevelController.prefab.meta b/Assets/Prefabs/LevelController.prefab.meta new file mode 100644 index 0000000..f20255c --- /dev/null +++ b/Assets/Prefabs/LevelController.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 235b3ad8eb2fc6b43b3296d18a8a9d06 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Composing.unity b/Assets/Scenes/Composing.unity index ab914c0..f93110e 100644 --- a/Assets/Scenes/Composing.unity +++ b/Assets/Scenes/Composing.unity @@ -1304,7 +1304,7 @@ PrefabInstance: m_TransformParent: {fileID: 690075884} m_Modifications: - target: {fileID: 3284696129798561372, guid: cb78e85aa373c3a4498d453f91e6f5e0, type: 3} - propertyPath: m_Materials.Array.data[0] + propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 9c0109e364aec314e90b4d1b28b893fa, type: 2} - target: {fileID: 3933166166638460809, guid: cb78e85aa373c3a4498d453f91e6f5e0, type: 3} @@ -1531,7 +1531,8 @@ PrefabInstance: value: 1 objectReference: {fileID: 0} m_RemovedComponents: [] - m_RemovedGameObjects: [{fileID: 2420552906730569295, guid: c919829cf5c2674429d0cd37945d2b13, type: 3}] + m_RemovedGameObjects: + - {fileID: 2420552906730569295, guid: c919829cf5c2674429d0cd37945d2b13, type: 3} m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c919829cf5c2674429d0cd37945d2b13, type: 3} diff --git a/Assets/Scripts/Enemies.meta b/Assets/Scripts/Enemies.meta new file mode 100644 index 0000000..3eccf27 --- /dev/null +++ b/Assets/Scripts/Enemies.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 775c6554dbb557740af9399208e5e947 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Enemy.cs b/Assets/Scripts/Enemies/Enemy.cs similarity index 100% rename from Assets/Scripts/Enemy.cs rename to Assets/Scripts/Enemies/Enemy.cs diff --git a/Assets/Scripts/Enemy.cs.meta b/Assets/Scripts/Enemies/Enemy.cs.meta similarity index 100% rename from Assets/Scripts/Enemy.cs.meta rename to Assets/Scripts/Enemies/Enemy.cs.meta diff --git a/Assets/Scripts/Game.meta b/Assets/Scripts/Game.meta new file mode 100644 index 0000000..415fa1f --- /dev/null +++ b/Assets/Scripts/Game.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6eda34b3d0947274d9f031e73ca44c4c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Game/GameController.cs b/Assets/Scripts/Game/GameController.cs new file mode 100644 index 0000000..4818e4e --- /dev/null +++ b/Assets/Scripts/Game/GameController.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEngine.SceneManagement; + +public class GameController : MonoBehaviour +{ + public List levels; +} + +[Serializable] +public class LevelInfo { + public SceneAsset scene; + public List enemies; +} + +[Serializable] +public class EnemyInLevel { + public GameObject enemy; + public int count; +} diff --git a/Assets/Scripts/Game/GameController.cs.meta b/Assets/Scripts/Game/GameController.cs.meta new file mode 100644 index 0000000..351264b --- /dev/null +++ b/Assets/Scripts/Game/GameController.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 21512d898f67c404d9a7519c0b7dcba8 \ No newline at end of file diff --git a/Assets/Scripts/Game/LevelController.cs b/Assets/Scripts/Game/LevelController.cs new file mode 100644 index 0000000..20f1fd7 --- /dev/null +++ b/Assets/Scripts/Game/LevelController.cs @@ -0,0 +1,8 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class LevelController : MonoBehaviour +{ + public List spawnPoints; +} diff --git a/Assets/Scripts/Game/LevelController.cs.meta b/Assets/Scripts/Game/LevelController.cs.meta new file mode 100644 index 0000000..147e791 --- /dev/null +++ b/Assets/Scripts/Game/LevelController.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 67f50dd8d32d83d4891b1a18fd12ec38 \ No newline at end of file diff --git a/Assets/Scripts/Player.meta b/Assets/Scripts/Player.meta new file mode 100644 index 0000000..81df1d3 --- /dev/null +++ b/Assets/Scripts/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a78510d754bdf9543b0b23e65b4c14bb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BulletProjectile.cs b/Assets/Scripts/Player/BulletProjectile.cs similarity index 100% rename from Assets/Scripts/BulletProjectile.cs rename to Assets/Scripts/Player/BulletProjectile.cs diff --git a/Assets/Scripts/BulletProjectile.cs.meta b/Assets/Scripts/Player/BulletProjectile.cs.meta similarity index 100% rename from Assets/Scripts/BulletProjectile.cs.meta rename to Assets/Scripts/Player/BulletProjectile.cs.meta diff --git a/Assets/Scripts/CameraMovement.cs b/Assets/Scripts/Player/CameraMovement.cs similarity index 100% rename from Assets/Scripts/CameraMovement.cs rename to Assets/Scripts/Player/CameraMovement.cs diff --git a/Assets/Scripts/CameraMovement.cs.meta b/Assets/Scripts/Player/CameraMovement.cs.meta similarity index 100% rename from Assets/Scripts/CameraMovement.cs.meta rename to Assets/Scripts/Player/CameraMovement.cs.meta diff --git a/Assets/Scripts/Pistol.cs b/Assets/Scripts/Player/Pistol.cs similarity index 100% rename from Assets/Scripts/Pistol.cs rename to Assets/Scripts/Player/Pistol.cs diff --git a/Assets/Scripts/Pistol.cs.meta b/Assets/Scripts/Player/Pistol.cs.meta similarity index 100% rename from Assets/Scripts/Pistol.cs.meta rename to Assets/Scripts/Player/Pistol.cs.meta diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs similarity index 100% rename from Assets/Scripts/PlayerMovement.cs rename to Assets/Scripts/Player/PlayerMovement.cs diff --git a/Assets/Scripts/PlayerMovement.cs.meta b/Assets/Scripts/Player/PlayerMovement.cs.meta similarity index 100% rename from Assets/Scripts/PlayerMovement.cs.meta rename to Assets/Scripts/Player/PlayerMovement.cs.meta diff --git a/Assets/Scripts/Weapon.cs b/Assets/Scripts/Player/Weapon.cs similarity index 100% rename from Assets/Scripts/Weapon.cs rename to Assets/Scripts/Player/Weapon.cs diff --git a/Assets/Scripts/Weapon.cs.meta b/Assets/Scripts/Player/Weapon.cs.meta similarity index 100% rename from Assets/Scripts/Weapon.cs.meta rename to Assets/Scripts/Player/Weapon.cs.meta diff --git a/Assets/Scripts/WeaponController.cs b/Assets/Scripts/Player/WeaponController.cs similarity index 100% rename from Assets/Scripts/WeaponController.cs rename to Assets/Scripts/Player/WeaponController.cs diff --git a/Assets/Scripts/WeaponController.cs.meta b/Assets/Scripts/Player/WeaponController.cs.meta similarity index 100% rename from Assets/Scripts/WeaponController.cs.meta rename to Assets/Scripts/Player/WeaponController.cs.meta From f899107d086edff8de41daa7ac06de2dce6699ea Mon Sep 17 00:00:00 2001 From: KOSMOGOR Date: Mon, 17 Mar 2025 15:36:15 +0300 Subject: [PATCH 3/3] update: player prefab fix: pistol not firing with higher fire rate --- Assets/Prefabs/Player.prefab | 166 +--------------------- Assets/Scenes/Composing.unity | 4 +- Assets/Scripts/Game/GameController.cs | 1 - Assets/Scripts/Player/Pistol.cs | 4 +- Assets/Scripts/Player/Weapon.cs | 2 +- Assets/Scripts/Player/WeaponController.cs | 4 +- 6 files changed, 12 insertions(+), 169 deletions(-) diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index f50b20e..1c691d4 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -62,7 +62,8 @@ Transform: m_LocalPosition: {x: 0, y: 0.5, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 - m_Children: [{fileID: 6673119647171785291}, {fileID: 1643315469074404677}, {fileID: 3053641561535516023}] + m_Children: + - {fileID: 3053641561535516023} m_Father: {fileID: 6890030909251295590} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &1094126809165627842 @@ -168,37 +169,6 @@ MonoBehaviour: m_MipBias: 0 m_VarianceClampScale: 0.9 m_ContrastAdaptiveSharpening: 0 ---- !u!1 &8550168148493531477 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1643315469074404677} - m_Layer: 0 - m_Name: Muzzle - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1643315469074404677 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8550168148493531477} - serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.5, y: -0.3, z: 1.8} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 4506534449155536579} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &9016311960615966999 GameObject: m_ObjectHideFlags: 0 @@ -214,7 +184,6 @@ GameObject: - component: {fileID: 397169322893853401} - component: {fileID: 1198108720433238150} - component: {fileID: 3263211181679880648} - - component: {fileID: 4266755283058417607} m_Layer: 0 m_Name: Player m_TagString: Untagged @@ -373,122 +342,6 @@ MonoBehaviour: m_EditorClassIdentifier: weapons: [] currentWeapon: 0 ---- !u!1001 &5007862695471124980 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 4506534449155536579} - m_Modifications: - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_Materials.Array.data[0] - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_Materials.Array.data[1] - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_Materials.Array.data[2] - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 697779476867176656, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_Materials.Array.data[3] - value: - objectReference: {fileID: 2100000, guid: 5eaf2c2de6813ae458216f3d63a8f0e1, type: 2} - - target: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_Name - value: Pistol_0.1 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalPosition.x - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalPosition.y - value: -0.5 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalPosition.z - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.w - value: 0.06162845 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.x - value: -0.70441604 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.y - value: -0.70441604 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalRotation.z - value: -0.06162845 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: -10 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: -180 - objectReference: {fileID: 0} - - target: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 90 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: - - targetCorrespondingSourceObject: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - insertIndex: -1 - addedObject: {fileID: 8320176447420130494} - m_SourcePrefab: {fileID: 100100000, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} ---- !u!1 &6327696402472954097 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 1346574968092522757, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - m_PrefabInstance: {fileID: 5007862695471124980} - m_PrefabAsset: {fileID: 0} ---- !u!114 &8320176447420130494 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6327696402472954097} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9b5e56940d7855caeb2d584265db0624, type: 3} - m_Name: - m_EditorClassIdentifier: - projectilePrefab: {fileID: 1562924000103655330, guid: bfe7100930f24fd52b5b66832f59cfa8, type: 3} - spawnPosition: {fileID: 1643315469074404677} - fireRate: 1 ---- !u!4 &6673119647171785291 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 1865667135861564351, guid: 9535c81cc2dffc94db2f5cbbc66cc790, type: 3} - m_PrefabInstance: {fileID: 5007862695471124980} - m_PrefabAsset: {fileID: 0} ---- !u!114 &4266755283058417607 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 9016311960615966999} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f3724861d6ef4a112910a3ef14207757, type: 3} - m_Name: - m_EditorClassIdentifier: - weapons: - - {fileID: 7482182703889749278} - currentWeapon: 0 --- !u!1001 &444904299868781356 PrefabInstance: m_ObjectHideFlags: 0 @@ -509,6 +362,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.y value: 90 objectReference: {fileID: 0} + - target: {fileID: 1587861691790886941, guid: af6264663cfc3ba499db761a90d861ca, type: 3} + propertyPath: m_Name + value: Muzzle + objectReference: {fileID: 0} - target: {fileID: 2812489602185112801, guid: af6264663cfc3ba499db761a90d861ca, type: 3} propertyPath: m_Name value: Pistol_0.1 @@ -563,14 +420,3 @@ Transform: m_CorrespondingSourceObject: {fileID: 3191971078612809307, guid: af6264663cfc3ba499db761a90d861ca, type: 3} m_PrefabInstance: {fileID: 444904299868781356} m_PrefabAsset: {fileID: 0} ---- !u!114 &7482182703889749278 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7060117665713712690, guid: af6264663cfc3ba499db761a90d861ca, type: 3} - m_PrefabInstance: {fileID: 444904299868781356} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 9b5e56940d7855caeb2d584265db0624, type: 3} - m_Name: - m_EditorClassIdentifier: diff --git a/Assets/Scenes/Composing.unity b/Assets/Scenes/Composing.unity index f93110e..c762483 100644 --- a/Assets/Scenes/Composing.unity +++ b/Assets/Scenes/Composing.unity @@ -574,7 +574,7 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &859145714 +--- !u!1001 &887070209 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -1604,4 +1604,4 @@ SceneRoots: - {fileID: 834035366} - {fileID: 111061984} - {fileID: 1259296367} - - {fileID: 859145714} + - {fileID: 887070209} diff --git a/Assets/Scripts/Game/GameController.cs b/Assets/Scripts/Game/GameController.cs index 4818e4e..d028331 100644 --- a/Assets/Scripts/Game/GameController.cs +++ b/Assets/Scripts/Game/GameController.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using UnityEditor; using UnityEngine; -using UnityEngine.SceneManagement; public class GameController : MonoBehaviour { diff --git a/Assets/Scripts/Player/Pistol.cs b/Assets/Scripts/Player/Pistol.cs index d11503a..c8b2986 100644 --- a/Assets/Scripts/Player/Pistol.cs +++ b/Assets/Scripts/Player/Pistol.cs @@ -6,10 +6,10 @@ public class Pistol : Weapon public Transform spawnPosition; public float fireRate = 1f; - float currentDelay = 0; + [SerializeField] float currentDelay = 0; public override void Shoot(bool keyDown, bool keyHold) { - if (keyDown && (fireRate == 0 || currentDelay == 1 / fireRate)) { + if (keyDown && (fireRate == 0 || currentDelay >= 1 / fireRate)) { Instantiate(projectilePrefab, spawnPosition.position, spawnPosition.rotation); currentDelay = 0; } diff --git a/Assets/Scripts/Player/Weapon.cs b/Assets/Scripts/Player/Weapon.cs index 2d2b424..8c7e3d8 100644 --- a/Assets/Scripts/Player/Weapon.cs +++ b/Assets/Scripts/Player/Weapon.cs @@ -2,7 +2,7 @@ using UnityEngine; public abstract class Weapon : MonoBehaviour { - public bool isActive { get; private set; } = true; + public bool isActive { get; private set; } = false; public abstract void Shoot(bool keyDown, bool keyHold); diff --git a/Assets/Scripts/Player/WeaponController.cs b/Assets/Scripts/Player/WeaponController.cs index 97bf87f..d92ab34 100644 --- a/Assets/Scripts/Player/WeaponController.cs +++ b/Assets/Scripts/Player/WeaponController.cs @@ -8,9 +8,7 @@ public class WeaponController : MonoBehaviour void Start() { weapons = GetComponentsInChildren(); - for (int i = 0; i < weapons.Length; ++i) { - if (i != currentWeapon) weapons[i].SetWeaponState(false); - } + if (weapons.Length > currentWeapon) weapons[currentWeapon].SetWeaponState(true); } void Update() {