diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index bba52768b..982dda6f8 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -724,6 +724,8 @@ + + diff --git a/Assets/Materials/UI/Map Gravity Lines.mat b/Assets/Materials/UI/Map Gravity Lines.mat index 749d876be..10f29890c 100644 --- a/Assets/Materials/UI/Map Gravity Lines.mat +++ b/Assets/Materials/UI/Map Gravity Lines.mat @@ -86,7 +86,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 - - _Scale: 0.5 + - _Scale: 3.9312708 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 diff --git a/Assets/Resources/Prefabs/Weapons/Constant Laser.prefab b/Assets/Resources/Prefabs/Weapons/Constant Laser.prefab new file mode 100644 index 000000000..80de0ad25 --- /dev/null +++ b/Assets/Resources/Prefabs/Weapons/Constant Laser.prefab @@ -0,0 +1,287 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4203591693056891767 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4203591693056891769} + - component: {fileID: 7397019002735257249} + m_Layer: 0 + m_Name: Constant Laser + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4203591693056891769 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4203591693056891767} + 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: 4203591693453005872} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7397019002735257249 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4203591693056891767} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c1a62592df67e114d880374819659914, type: 3} + m_Name: + m_EditorClassIdentifier: + LaserPrototype: {fileID: 4203591693453005875} +--- !u!1 &4203591693453005871 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4203591693453005872} + - component: {fileID: 4917407267329759965} + - component: {fileID: 4203591693453005873} + - component: {fileID: 4203591693453005875} + m_Layer: 0 + m_Name: Laser + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4203591693453005872 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4203591693453005871} + 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: [] + m_Father: {fileID: 4203591693056891769} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4917407267329759965 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4203591693453005871} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0fdff1d9c6e4a574f987f8cecdb87f36, type: 3} + m_Name: + m_EditorClassIdentifier: + StartCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + EndCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + IntensityCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0.051179443 + outSlope: 0.051179443 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0.24423963 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 34 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0 + outSlope: -0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.22580647 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + StartDuration: 0.25 + FadeDuration: 0.15 + CycleDuration: 1 + LineRenderer: {fileID: 4203591693453005873} +--- !u!120 &4203591693453005873 +LineRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4203591693453005871} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 521deb6b226a2f647b1f07d7478f7770, 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_Positions: + - {x: 0, y: 0, z: 0} + - {x: 0, y: 0, z: 10} + m_Parameters: + serializedVersion: 3 + widthMultiplier: 0.2 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 1, g: 0.05098039, b: 0.98893297, a: 1} + key1: {r: 1, g: 0.26785484, b: 0.054901958, a: 1} + key2: {r: 1, g: 1, b: 1, a: 0} + key3: {r: 1, g: 1, b: 1, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 65535 + ctime3: 65535 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 0 + numCapVertices: 2 + alignment: 0 + textureMode: 0 + shadowBias: 0.5 + generateLightingData: 0 + m_UseWorldSpace: 1 + m_Loop: 0 +--- !u!114 &4203591693453005875 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4203591693453005871} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Resources/Prefabs/Weapons/Constant Laser.prefab.meta b/Assets/Resources/Prefabs/Weapons/Constant Laser.prefab.meta new file mode 100644 index 000000000..d2eb6af6a --- /dev/null +++ b/Assets/Resources/Prefabs/Weapons/Constant Laser.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c02ed92d24947fe4f948d073cc7378b0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/ARPG.unity b/Assets/Scenes/ARPG.unity index aa2f8c4b5..a12320996 100644 --- a/Assets/Scenes/ARPG.unity +++ b/Assets/Scenes/ARPG.unity @@ -1972,99 +1972,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 181812642} m_CullTransparentMesh: 0 ---- !u!1 &191729603 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 191729604} - - component: {fileID: 191729607} - - component: {fileID: 191729606} - - component: {fileID: 191729605} - m_Layer: 5 - m_Name: Temperature Display - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &191729604 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 191729603} - 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: [] - m_Father: {fileID: 1359207439} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 65, y: -194} - m_SizeDelta: {x: 128, y: 128} - m_Pivot: {x: 0, y: 0} ---- !u!114 &191729605 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 191729603} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 2100000, guid: c9fa12033c0c6ba4f89d8c292cd33f09, type: 2} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 0 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 0 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_Texture: {fileID: 2800000, guid: d5b05e6f76a0acd45b4f6e7d76a63665, type: 3} - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 ---- !u!114 &191729606 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 191729603} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreLayout: 1 - m_MinWidth: -1 - m_MinHeight: -1 - m_PreferredWidth: -1 - m_PreferredHeight: -1 - m_FlexibleWidth: -1 - m_FlexibleHeight: -1 - m_LayoutPriority: 1 ---- !u!222 &191729607 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 191729603} - m_CullTransparentMesh: 0 --- !u!1 &195655950 GameObject: m_ObjectHideFlags: 0 @@ -5525,7 +5432,7 @@ MonoBehaviour: ThermalTextures: [] ThermalToggleRegionSize: 0.2 NodePrototype: {fileID: 1889622745} - TemperatureDisplay: {fileID: 191729605} + TemperatureDisplay: {fileID: 0} TemperatureColor: {fileID: 2800000, guid: dc6059983b32c9749a1d5975fd00ec48, type: 3} TemperatureColorCurve: Exponent: 1.4 @@ -15575,7 +15482,6 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 191729604} - {fileID: 1889622743} m_Father: {fileID: 410701128} m_RootOrder: 4 @@ -17647,7 +17553,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 55.675 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -18503,7 +18409,7 @@ PrefabInstance: - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 60.98 objectReference: {fileID: 0} - target: {fileID: 878382121558056004, guid: 2758dfa2744d7ad4d8877545189d116e, type: 3} @@ -21084,7 +20990,7 @@ RectTransform: - {fileID: 817565121} - {fileID: 109242181} m_Father: {fileID: 1359207439} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs new file mode 100644 index 000000000..205cb9d8a --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs @@ -0,0 +1,94 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ConstantLaser : MonoBehaviour +{ + public AnimationCurve StartCurve; + public AnimationCurve EndCurve; + public AnimationCurve IntensityCurve; + public float StartDuration; + public float FadeDuration; + public float CycleDuration; + public LineRenderer LineRenderer; + + public float Damage { get; set; } + public float Penetration { get; set; } + public float Spread { get; set; } + public DamageType DamageType { get; set; } + public Entity SourceEntity { get; set; } + public float Range { get; set; } + + private float _intensity; + private float _stopIntensity; + private bool _starting; + private bool _stopping; + private float _startTime; + private float _cycleStartTime; + private readonly Vector3[] _zeros = {Vector3.zero, Vector3.zero}; + + private void OnEnable() + { + _stopping = false; + _starting = true; + _startTime = Time.time; + LineRenderer.SetPositions(_zeros); + } + + private void Update() + { + if (_stopping) + { + var lerp = (Time.time - _startTime) / FadeDuration; + LineRenderer.widthMultiplier = EndCurve.Evaluate(lerp) * _stopIntensity; + + if (lerp > 1) + { + GetComponent().ReturnToPool(); + return; + } + } + else + { + var lerp = (Time.time - _startTime) / StartDuration; + if (lerp > 1) + { + if (_starting) + { + _starting = false; + _cycleStartTime = Time.time; + } + _intensity = IntensityCurve.Evaluate((Time.time - _cycleStartTime) / CycleDuration % CycleDuration); + LineRenderer.widthMultiplier = _intensity; + } + else + { + LineRenderer.widthMultiplier = StartCurve.Evaluate(lerp); + } + } + + LineRenderer.SetPosition(0, transform.position); + RaycastHit hit; + if (Physics.Raycast(new Ray(transform.position, transform.forward), out hit, Range, 1)) + { + var hull = hit.collider.GetComponent(); + if (hull) + { + if (hull.Entity != SourceEntity) + { + hull.SendHit(Damage * Time.deltaTime, Penetration, Spread, DamageType, SourceEntity, hit, transform.forward); + } + } + LineRenderer.SetPosition(1, hit.point); + } + else + LineRenderer.SetPosition(1, transform.position + transform.forward * Range); + } + + public void Stop() + { + _stopping = true; + _stopIntensity = _intensity; + _startTime = Time.time; + } +} diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs.meta b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs.meta new file mode 100644 index 000000000..e7b8751f5 --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0fdff1d9c6e4a574f987f8cecdb87f36 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 90 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs new file mode 100644 index 000000000..145b07777 --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ConstantLaserManager : ConstantWeaponEffectManager +{ + public Prototype LaserPrototype; + + private Dictionary _lasers = new Dictionary(); + + public override void StartFiring(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target) + { + var p = LaserPrototype.Instantiate(); + p.SourceEntity = source.Entity; + var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y]; + var barrel = source.GetBarrel(hp); + p.Range = source.Entity.ItemManager.Evaluate(data.Range, item.EquippableItem, source.Entity); + var t = p.transform; + t.SetParent(barrel); + t.forward = barrel.forward; + t.position = barrel.position; + p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item.EquippableItem, source.Entity); + p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item.EquippableItem, source.Entity); + p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item.EquippableItem, source.Entity); + p.DamageType = data.DamageType; + _lasers.Add(item, p); + } + + public override void StopFiring(EquippedItem item) + { + _lasers[item].Stop(); + _lasers.Remove(item); + } +} diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs.meta b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs.meta new file mode 100644 index 000000000..ad5d9e741 --- /dev/null +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c1a62592df67e114d880374819659914 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantWeaponEffectManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantWeaponEffectManager.cs index fc8b0f185..0a0dc8438 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantWeaponEffectManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantWeaponEffectManager.cs @@ -4,6 +4,6 @@ using UnityEngine; public abstract class ConstantWeaponEffectManager : MonoBehaviour { - public abstract void Start(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target); - public abstract void Stop(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target); + public abstract void StartFiring(WeaponData data, EquippedItem item, EntityInstance source, EntityInstance target); + public abstract void StopFiring(EquippedItem item); } diff --git a/Assets/Scripts/Sector Display/SectorRenderer.cs b/Assets/Scripts/Sector Display/SectorRenderer.cs index 7d5f7bb9e..adf5a1474 100644 --- a/Assets/Scripts/Sector Display/SectorRenderer.cs +++ b/Assets/Scripts/Sector Display/SectorRenderer.cs @@ -221,6 +221,25 @@ public class SectorRenderer : MonoBehaviour instantWeapon.OnFire += () => _instantWeaponManagers[data].Fire(data, item, instance, entity.Target.Value != null ? EntityInstances[entity.Target.Value] : null); } + + if (behavior is ConstantWeapon constantWeapon) + { + var data = (ConstantWeaponData) constantWeapon.Data; + if (!_constantWeaponManagers.ContainsKey(data)) + { + var managerPrefab = UnityHelpers.LoadAsset(data.EffectPrefab); + if(managerPrefab) + { + _constantWeaponManagers.Add(data, Instantiate(managerPrefab, EffectManagerParent)); + } + else Debug.LogError($"No ConstantWeaponEffectManager prefab found at path {data.EffectPrefab}"); + } + + constantWeapon.OnStartFiring += () => + _constantWeaponManagers[data].StartFiring(data, item, instance, entity.Target.Value != null ? EntityInstances[entity.Target.Value] : null); + constantWeapon.OnStopFiring += () => + _constantWeaponManagers[data].StopFiring(item); + } } } instance.RadiatorMeshes = new Dictionary(); diff --git a/Assets/Scripts/UI/InventoryMenu.cs b/Assets/Scripts/UI/InventoryMenu.cs index 80a3ea3e0..5cc495956 100644 --- a/Assets/Scripts/UI/InventoryMenu.cs +++ b/Assets/Scripts/UI/InventoryMenu.cs @@ -196,7 +196,7 @@ public class InventoryMenu : MonoBehaviour panel.IgnoreOccupancy = null; panel.RefreshCells(); - if(_dragTargetPanel!=panel) + if(_dragTargetPanel!=panel && _dragTargetPanel != null) _dragTargetPanel.RefreshCells(); _dragItem = null; diff --git a/GameData/Presets/Longinus.preset b/GameData/Presets/Longinus.preset index 7ba38a092..e89d878e1 100644 Binary files a/GameData/Presets/Longinus.preset and b/GameData/Presets/Longinus.preset differ