From 991d298a6579fa2ddb97766f94c77878a5bb954f Mon Sep 17 00:00:00 2001 From: KOSMOGOR Date: Thu, 1 May 2025 13:44:17 +0300 Subject: [PATCH] add: working rocket launcher fix: rocket launcher projectile update: now all weapons are ready to shoot at start --- Assets/Materials/Emmited/Orange_Emit 1.mat | 2 +- Assets/Materials/Emmited/Red_Emit.mat | 137 ++++++++++++++++ Assets/Materials/Emmited/Red_Emit.mat.meta | 8 + Assets/Prefabs/Game/Player.prefab | 63 +++++++ Assets/Prefabs/Weapons/Rocket.prefab | 155 ++++++++++++++++++ Assets/Prefabs/Weapons/Rocket.prefab.meta | 7 + .../Weapons/Rocket_Launcher_0.1.prefab | 139 ++++++++++++++++ .../Weapons/Rocket_Launcher_0.1.prefab.meta | 7 + Assets/Scripts/Player/Minigun.cs | 4 + Assets/Scripts/Player/Pistol.cs | 4 + Assets/Scripts/Player/Rifle.cs | 4 + Assets/Scripts/Player/RocketLauncher.cs | 4 + Assets/Scripts/Player/RocketProjectile.cs | 2 +- 13 files changed, 534 insertions(+), 2 deletions(-) create mode 100644 Assets/Materials/Emmited/Red_Emit.mat create mode 100644 Assets/Materials/Emmited/Red_Emit.mat.meta create mode 100644 Assets/Prefabs/Weapons/Rocket.prefab create mode 100644 Assets/Prefabs/Weapons/Rocket.prefab.meta create mode 100644 Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab create mode 100644 Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab.meta diff --git a/Assets/Materials/Emmited/Orange_Emit 1.mat b/Assets/Materials/Emmited/Orange_Emit 1.mat index 37beb00..7e49211 100644 --- a/Assets/Materials/Emmited/Orange_Emit 1.mat +++ b/Assets/Materials/Emmited/Orange_Emit 1.mat @@ -118,7 +118,7 @@ Material: m_Colors: - _BaseColor: {r: 1, g: 0, b: 0, a: 1} - _Color: {r: 1, g: 0, b: 0, a: 1} - - _EmissionColor: {r: 1, g: 0.6300467, b: 0, a: 1} + - _EmissionColor: {r: 1, g: 0.28152817, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] m_AllowLocking: 1 diff --git a/Assets/Materials/Emmited/Red_Emit.mat b/Assets/Materials/Emmited/Red_Emit.mat new file mode 100644 index 0000000..9357ce4 --- /dev/null +++ b/Assets/Materials/Emmited/Red_Emit.mat @@ -0,0 +1,137 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Red_Emit + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] + m_LightmapFlags: 2 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 0, b: 0, a: 1} + - _Color: {r: 1, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 1, g: 0.00000024636586, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &1224925544621896716 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 9 diff --git a/Assets/Materials/Emmited/Red_Emit.mat.meta b/Assets/Materials/Emmited/Red_Emit.mat.meta new file mode 100644 index 0000000..19048ca --- /dev/null +++ b/Assets/Materials/Emmited/Red_Emit.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6fbfebf8ca438c7459a0b17f135393e0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Game/Player.prefab b/Assets/Prefabs/Game/Player.prefab index 8c1335f..32f6915 100644 --- a/Assets/Prefabs/Game/Player.prefab +++ b/Assets/Prefabs/Game/Player.prefab @@ -240,6 +240,7 @@ Transform: - {fileID: 3053641561535516023} - {fileID: 7306251229952926972} - {fileID: 4942982111120058040} + - {fileID: 2277218851824731727} m_Father: {fileID: 6890030909251295590} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &1094126809165627842 @@ -1089,6 +1090,68 @@ Transform: m_CorrespondingSourceObject: {fileID: 3191971078612809307, guid: af6264663cfc3ba499db761a90d861ca, type: 3} m_PrefabInstance: {fileID: 444904299868781356} m_PrefabAsset: {fileID: 0} +--- !u!1001 &2689947150218518565 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 4506534449155536579} + m_Modifications: + - target: {fileID: 3568261002656955600, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_Name + value: Rocket_Launcher_0.1 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalPosition.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalPosition.y + value: -0.3 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalPosition.z + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalRotation.w + value: 0.50008726 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalRotation.x + value: -0.49991274 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalRotation.y + value: 0.50008726 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalRotation.z + value: 0.49991274 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -89.98 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} +--- !u!4 &2277218851824731727 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4237556113342424682, guid: 5d2e8efb31151674bb2feed146ad725c, type: 3} + m_PrefabInstance: {fileID: 2689947150218518565} + m_PrefabAsset: {fileID: 0} --- !u!1001 &6803844382836373506 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Weapons/Rocket.prefab b/Assets/Prefabs/Weapons/Rocket.prefab new file mode 100644 index 0000000..683c9ec --- /dev/null +++ b/Assets/Prefabs/Weapons/Rocket.prefab @@ -0,0 +1,155 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1562924000103655330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2987293529414042391} + - component: {fileID: 3266538827119481022} + - component: {fileID: 3277822925141770390} + - component: {fileID: -8958570174584186611} + - component: {fileID: 8393546946202406891} + - component: {fileID: 1686337259510244727} + m_Layer: 0 + m_Name: Rocket + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2987293529414042391 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562924000103655330} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.3, y: 0.3, z: 0.6} + m_ConstrainProportionsScale: 1 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &3266538827119481022 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562924000103655330} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &3277822925141770390 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562924000103655330} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 6fbfebf8ca438c7459a0b17f135393e0, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!54 &-8958570174584186611 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562924000103655330} + serializedVersion: 4 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 1, y: 1, z: 1} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 1 + m_UseGravity: 0 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 2 +--- !u!135 &8393546946202406891 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562924000103655330} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &1686337259510244727 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1562924000103655330} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4b620769c55dfa849b7fd23858b7cc1f, type: 3} + m_Name: + m_EditorClassIdentifier: + speed: 20 + damage: 50 + explosionRadius: 5 + timeToLive: 3 diff --git a/Assets/Prefabs/Weapons/Rocket.prefab.meta b/Assets/Prefabs/Weapons/Rocket.prefab.meta new file mode 100644 index 0000000..940dab1 --- /dev/null +++ b/Assets/Prefabs/Weapons/Rocket.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3a70e789a6a31084b80865001503bda9 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab b/Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab new file mode 100644 index 0000000..1998c07 --- /dev/null +++ b/Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab @@ -0,0 +1,139 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1003321606586863073 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5679113557892405372} + m_Layer: 0 + m_Name: Muzzle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5679113557892405372 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1003321606586863073} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4237556113342424682} + m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} +--- !u!1001 &4414771904518422913 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalScale.x + value: 20 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalScale.y + value: 20 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalScale.z + value: 20 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalPosition.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalRotation.w + value: 0.50008726 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalRotation.x + value: -0.49991274 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalRotation.y + value: 0.50008726 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalRotation.z + value: 0.49991274 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -89.98 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 90 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + propertyPath: m_Name + value: Rocket_Launcher_0.1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: + - targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + insertIndex: -1 + addedObject: {fileID: 5679113557892405372} + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + insertIndex: -1 + addedObject: {fileID: 1868457431709088792} + m_SourcePrefab: {fileID: 100100000, guid: edd6afebf5ca7e842a4c836129368353, type: 3} +--- !u!1 &3568261002656955600 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + m_PrefabInstance: {fileID: 4414771904518422913} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1868457431709088792 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3568261002656955600} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: adc348041e3fec6468a64ec626053bc3, type: 3} + m_Name: + m_EditorClassIdentifier: + bulletType: 2 + projectilePrefab: {fileID: 1562924000103655330, guid: 3a70e789a6a31084b80865001503bda9, type: 3} + spawnPosition: {fileID: 5679113557892405372} + fireRate: 0.3 + currentDelay: 0 +--- !u!4 &4237556113342424682 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: edd6afebf5ca7e842a4c836129368353, type: 3} + m_PrefabInstance: {fileID: 4414771904518422913} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab.meta b/Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab.meta new file mode 100644 index 0000000..6656045 --- /dev/null +++ b/Assets/Prefabs/Weapons/Rocket_Launcher_0.1.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5d2e8efb31151674bb2feed146ad725c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player/Minigun.cs b/Assets/Scripts/Player/Minigun.cs index 822c541..f5331a3 100644 --- a/Assets/Scripts/Player/Minigun.cs +++ b/Assets/Scripts/Player/Minigun.cs @@ -15,6 +15,10 @@ public class Minigun : Weapon } } + void Start() { + if (fireRate != 0) currentDelay = 1 / fireRate; + } + void Update() { if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate); } diff --git a/Assets/Scripts/Player/Pistol.cs b/Assets/Scripts/Player/Pistol.cs index c8b2986..af997fe 100644 --- a/Assets/Scripts/Player/Pistol.cs +++ b/Assets/Scripts/Player/Pistol.cs @@ -15,6 +15,10 @@ public class Pistol : Weapon } } + void Start() { + if (fireRate != 0) currentDelay = 1 / fireRate; + } + void Update() { if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate); } diff --git a/Assets/Scripts/Player/Rifle.cs b/Assets/Scripts/Player/Rifle.cs index edbe7b2..c822d2e 100644 --- a/Assets/Scripts/Player/Rifle.cs +++ b/Assets/Scripts/Player/Rifle.cs @@ -15,6 +15,10 @@ public class Rifle : Weapon } } + void Start() { + if (fireRate != 0) currentDelay = 1 / fireRate; + } + void Update() { if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate); } diff --git a/Assets/Scripts/Player/RocketLauncher.cs b/Assets/Scripts/Player/RocketLauncher.cs index 9abbbe0..5fef68d 100644 --- a/Assets/Scripts/Player/RocketLauncher.cs +++ b/Assets/Scripts/Player/RocketLauncher.cs @@ -15,6 +15,10 @@ public class RocketLauncher : Weapon } } + void Start() { + if (fireRate != 0) currentDelay = 1 / fireRate; + } + void Update() { if (fireRate != 0) currentDelay = Mathf.Clamp(currentDelay += Time.deltaTime, 0, 1 / fireRate); } diff --git a/Assets/Scripts/Player/RocketProjectile.cs b/Assets/Scripts/Player/RocketProjectile.cs index e05965f..c8758b4 100644 --- a/Assets/Scripts/Player/RocketProjectile.cs +++ b/Assets/Scripts/Player/RocketProjectile.cs @@ -25,7 +25,7 @@ public class RocketProjectile : MonoBehaviour Collider[] colliders = Physics.OverlapSphere(transform.position, explosionRadius); foreach (Collider collider in colliders) { if (collider.gameObject.CompareTag("Enemy")) { - Enemy enemy = other.GetComponent(); + Enemy enemy = collider.GetComponent(); enemy.DealDamage(damage); } }