feat: changed FORGE3D Sci-Fi Effects to fit my needs better

This commit is contained in:
Jakob Feldmann 2024-06-12 13:31:29 +02:00
parent 7a3e0e0a69
commit aff9e88a93
41 changed files with 2175 additions and 48970 deletions

View File

@ -25,12 +25,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100002} m_GameObject: {fileID: 100002}
serializedVersion: 2
m_LocalRotation: {x: 0.5, y: 0.5, z: -0.5, w: 0.5} m_LocalRotation: {x: 0.5, y: 0.5, z: -0.5, w: 0.5}
m_LocalPosition: {x: 0, y: 0.000000019868, z: -0.32} m_LocalPosition: {x: 0, y: 0.000000019868, z: -0.32}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 400004} m_Father: {fileID: 400004}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 90, y: 90, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 90, z: 0}
--- !u!33 &3300002 --- !u!33 &3300002
MeshFilter: MeshFilter:
@ -51,10 +52,12 @@ MeshRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_RayTracingMode: 2 m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -79,6 +82,7 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &100004 --- !u!1 &100004
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -104,14 +108,15 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004} m_GameObject: {fileID: 100004}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3, y: 3, z: 3} m_LocalScale: {x: 3, y: 3, z: 3}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 4000010027762468} - {fileID: 4000010027762468}
- {fileID: 400002} - {fileID: 400002}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11400000 --- !u!114 &11400000
MonoBehaviour: MonoBehaviour:
@ -128,8 +133,11 @@ MonoBehaviour:
fxType: 11 fxType: 11
layerMask: layerMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 136
lifeTime: 1 Damage: 150
BlastMagnitude: 100
OwnerId: 0
LifeTime: 5
despawnDelay: 0 despawnDelay: 0
velocity: 300 velocity: 300
RaycastAdvance: 2 RaycastAdvance: 2
@ -178,12 +186,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010589384354} m_GameObject: {fileID: 1000010589384354}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0.000000019868, z: -0.32} m_LocalPosition: {x: 0, y: 0.000000019868, z: -0.32}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 400004} m_Father: {fileID: 400004}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!33 &33000011791246272 --- !u!33 &33000011791246272
MeshFilter: MeshFilter:
@ -204,10 +213,12 @@ MeshRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_RayTracingMode: 2 m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -232,3 +243,4 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}

View File

@ -26,15 +26,17 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000} m_GameObject: {fileID: 100000}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!120 &12000000 --- !u!120 &12000000
LineRenderer: LineRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -44,10 +46,12 @@ LineRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0 m_MotionVectors: 0
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0 m_ReflectionProbeUsage: 0
m_RayTracingMode: 0 m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -129,16 +133,20 @@ LineRenderer:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
numCornerVertices: 0 numCornerVertices: 0
numCapVertices: 0 numCapVertices: 0
alignment: 0 alignment: 0
textureMode: 0 textureMode: 0
textureScale: {x: 1, y: 1}
shadowBias: 0 shadowBias: 0
generateLightingData: 0 generateLightingData: 0
m_MaskInteraction: 0
m_UseWorldSpace: 0 m_UseWorldSpace: 0
m_Loop: 0 m_Loop: 0
m_ApplyActiveColorSpace: 0
--- !u!114 &11400000 --- !u!114 &11400000
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -153,9 +161,12 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
layerMask: layerMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 136
Damage: 350
BlastMagnitude: 350
OwnerId: 0
fxType: 5 fxType: 5
OneShot: 1 OneShot: 0
BeamFrames: BeamFrames:
- {fileID: 2800000, guid: 93d10af4c9d98aa48abb06818e0ab192, type: 3} - {fileID: 2800000, guid: 93d10af4c9d98aa48abb06818e0ab192, type: 3}
- {fileID: 2800000, guid: ebe4a3a4b5a73e549b0a5fd41d68055b, type: 3} - {fileID: 2800000, guid: ebe4a3a4b5a73e549b0a5fd41d68055b, type: 3}

View File

@ -5143,10 +5143,13 @@ MonoBehaviour:
fxType: 4 fxType: 4
layerMask: layerMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 9 m_Bits: 136
lifeTime: 5 Damage: 200
BlastMagnitude: 200
OwnerId: 0
LifeTime: 5
despawnDelay: 1 despawnDelay: 1
velocity: 75 velocity: 130
RaycastAdvance: 2 RaycastAdvance: 2
DelayDespawn: 1 DelayDespawn: 1
delayedParticles: delayedParticles:

View File

@ -25,12 +25,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000} m_GameObject: {fileID: 100000}
serializedVersion: 2
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0.7987106} m_LocalPosition: {x: 0, y: 0, z: 0.7987106}
m_LocalScale: {x: 2.2, y: 1, z: 1} m_LocalScale: {x: 2.2, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 400004} m_Father: {fileID: 400004}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!33 &3300000 --- !u!33 &3300000
MeshFilter: MeshFilter:
@ -51,10 +52,12 @@ MeshRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_RayTracingMode: 2 m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -79,6 +82,7 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &100002 --- !u!1 &100002
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -104,12 +108,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100002} m_GameObject: {fileID: 100002}
serializedVersion: 2
m_LocalRotation: {x: 0.5, y: -0.5, z: 0.5, w: 0.5} m_LocalRotation: {x: 0.5, y: -0.5, z: 0.5, w: 0.5}
m_LocalPosition: {x: 0, y: 0, z: 0.7987106} m_LocalPosition: {x: 0, y: 0, z: 0.7987106}
m_LocalScale: {x: 2.2, y: 1, z: 1} m_LocalScale: {x: 2.2, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 400004} m_Father: {fileID: 400004}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 90} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 90}
--- !u!33 &3300002 --- !u!33 &3300002
MeshFilter: MeshFilter:
@ -130,10 +135,12 @@ MeshRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_RayTracingMode: 2 m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -158,6 +165,7 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &100004 --- !u!1 &100004
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -183,15 +191,16 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004} m_GameObject: {fileID: 100004}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 400002} - {fileID: 400002}
- {fileID: 400000} - {fileID: 400000}
- {fileID: 400006} - {fileID: 400006}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11400000 --- !u!114 &11400000
MonoBehaviour: MonoBehaviour:
@ -235,6 +244,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 400006} - component: {fileID: 400006}
- component: {fileID: 10800000} - component: {fileID: 10800000}
- component: {fileID: 8317281421139234932}
m_Layer: 0 m_Layer: 0
m_Name: Point light m_Name: Point light
m_TagString: Untagged m_TagString: Untagged
@ -249,12 +259,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006} m_GameObject: {fileID: 100006}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.6052952} m_LocalPosition: {x: 0, y: 0, z: 0.6052952}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 400004} m_Father: {fileID: 400004}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &10800000 --- !u!108 &10800000
Light: Light:
@ -315,5 +326,29 @@ Light:
m_UseColorTemperature: 0 m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0 m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0 m_ShadowRadius: 0
m_ShadowAngle: 0 m_ShadowAngle: 0
--- !u!114 &8317281421139234932
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 3
m_UsePipelineSettings: 1
m_AdditionalLightsShadowResolutionTier: 2
m_LightLayerMask: 1
m_RenderingLayers: 1
m_CustomShadowLayers: 0
m_ShadowLayerMask: 1
m_ShadowRenderingLayers: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
m_SoftShadowQuality: 0

View File

@ -1,5 +1,181 @@
%YAML 1.1 %YAML 1.1
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!1001 &6391351660618341151
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 100008, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 100010, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 100012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_Name
value: solo_gun_flare_trail Variant
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 0.94
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime1
value: 2120
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime2
value: 62837
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime3
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime4
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime5
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime6
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key2.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key3.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key4.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key5.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key6.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.m_NumAlphaKeys
value: 4
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ShapeModule.enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ShapeModule.radius.value
value: 0.09
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.scalar
value: 5
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 0.94
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.gravityModifier.scalar
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800006, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 8.07
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 100012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
insertIndex: -1
addedObject: {fileID: -8093627500212825932}
- targetCorrespondingSourceObject: {fileID: 100012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
insertIndex: -1
addedObject: {fileID: 8214279908182662867}
m_SourcePrefab: {fileID: 100100000, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
--- !u!1 &6391351660618440115 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
m_PrefabInstance: {fileID: 6391351660618341151}
m_PrefabAsset: {fileID: 0}
--- !u!114 &-8093627500212825932 --- !u!114 &-8093627500212825932
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -15,8 +191,11 @@ MonoBehaviour:
fxType: 1 fxType: 1
layerMask: layerMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 136
lifeTime: 2 Damage: 200
BlastMagnitude: 200
OwnerId: 0
LifeTime: 5
despawnDelay: 0 despawnDelay: 0
velocity: 200 velocity: 200
RaycastAdvance: 2 RaycastAdvance: 2
@ -40,170 +219,3 @@ MonoBehaviour:
MaxScale: 1.2 MaxScale: 1.2
MinRotation: -360 MinRotation: -360
MaxRotaion: 360 MaxRotaion: 360
--- !u!1001 &6391351660618341151
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 100008, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 100010, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 100012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_Name
value: solo_gun_flare_trail Variant
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400012, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 0.94
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime2
value: 62837
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key2.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key3.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key4.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key5.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.key6.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime3
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime4
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime5
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime6
value: 65535
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.m_NumAlphaKeys
value: 4
objectReference: {fileID: 0}
- target: {fileID: 19800002, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ColorModule.gradient.maxGradient.atime1
value: 2120
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 0.94
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ShapeModule.enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: ShapeModule.radius.value
value: 0.09
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.gravityModifier.scalar
value: 0
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.scalar
value: 5
objectReference: {fileID: 0}
- target: {fileID: 19800004, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startColor.maxColor.a
value: 1
objectReference: {fileID: 0}
- target: {fileID: 19800006, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 8.07
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 157253c33b5e2ae4c99dd92c193b5413, type: 3}
--- !u!1 &6391351660618440115 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100012, guid: 157253c33b5e2ae4c99dd92c193b5413,
type: 3}
m_PrefabInstance: {fileID: 6391351660618341151}
m_PrefabAsset: {fileID: 0}

View File

@ -443,7 +443,7 @@ namespace FORGE3D
} }
// Play heavy plasma beam shot and loop audio at specific position // Play heavy plasma beam shot and loop audio at specific position
public void PlasmaBeamHeavyLoop(Vector3 pos, Transform loopParent) public AudioSource PlasmaBeamHeavyLoop(Vector3 pos, Transform loopParent)
{ {
AudioSource aOpen = AudioSource aOpen =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamHeavyOpen, pos, null) F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamHeavyOpen, pos, null)
@ -468,6 +468,7 @@ namespace FORGE3D
aLoop.Play(); aLoop.Play();
} }
return aLoop;
} }
// Play heavy plasma beam closing audio at specific position // Play heavy plasma beam closing audio at specific position

View File

@ -8,67 +8,75 @@ namespace FORGE3D
{ {
public LayerMask layerMask; public LayerMask layerMask;
public F3DFXType fxType; // Weapon type [Tooltip("The amount of damage this projectil inflicts generally.")]
public bool OneShot; // Constant or single beam? public float Damage = 1f;
[Tooltip("The magnitude of the blast when hitting something.")]
public float BlastMagnitude = 0.1f;
public Texture[] BeamFrames; // Animation frame sequence [HideInInspector]
public float FrameStep; // Animation time public int OwnerId = 0;
public float beamScale; // Default beam scale to be kept over distance public WeaponEffect fxType; // Weapon type
public float MaxBeamLength; // Maximum beam length public bool OneShot; // Constant or single beam?
public bool AnimateUV; // UV Animation public Texture[] BeamFrames; // Animation frame sequence
public float UVTime; // UV Animation speed public float FrameStep; // Animation time
public Transform rayImpact; // Impact transform public float beamScale; // Default beam scale to be kept over distance
public Transform rayMuzzle; // Muzzle flash transform public float MaxBeamLength; // Maximum beam length
LineRenderer lineRenderer; // Line rendered component public bool AnimateUV; // UV Animation
RaycastHit hitPoint; // Raycast structure public float UVTime; // UV Animation speed
RaycastHit2D hitPoint2D; // Raycasthit in 2d
int frameNo; // Frame counter public Transform rayImpact; // Impact transform
int FrameTimerID; // Frame timer reference public Transform rayMuzzle; // Muzzle flash transform
float beamLength; // Current beam length
float initialBeamOffset; // Initial UV offset
public float fxOffset; // Fx offset from bullet's touch point
void Awake() LineRenderer lineRenderer; // Line rendered component
{ RaycastHit hitPoint; // Raycast structure
// Get line renderer component RaycastHit2D hitPoint2D; // Raycasthit in 2d
lineRenderer = GetComponent<LineRenderer>();
// Assign first frame texture int frameNo; // Frame counter
if (!AnimateUV && BeamFrames.Length > 0) int FrameTimerID; // Frame timer reference
lineRenderer.material.mainTexture = BeamFrames[0]; float beamLength; // Current beam length
float initialBeamOffset; // Initial UV offset
public float fxOffset; // Fx offset from bullet's touch point
// Randomize uv offset void Awake()
initialBeamOffset = Random.Range(0f, 5f); {
} // Get line renderer component
lineRenderer = GetComponent<LineRenderer>();
// OnSpawned called by pool manager // Assign first frame texture
void OnSpawned() if (!AnimateUV && BeamFrames.Length > 0)
{ lineRenderer.material.mainTexture = BeamFrames[0];
// Do one time raycast in case of one shot flag
if (OneShot)
Raycast();
// Start animation sequence if beam frames array has more than 2 elements // Randomize uv offset
if (BeamFrames.Length > 1) initialBeamOffset = Random.Range(0f, 5f);
Animate(); }
}
// OnDespawned called by pool manager // OnSpawned called by pool manager
void OnDespawned() void OnSpawned()
{ {
// Reset frame counter // Do one time raycast in case of one shot flag
frameNo = 0; if (OneShot)
Raycast();
// Clear timer // Start animation sequence if beam frames array has more than 2 elements
if (FrameTimerID != -1) if (BeamFrames.Length > 1)
{ Animate();
F3DTime.time.RemoveTimer(FrameTimerID); }
FrameTimerID = -1;
// OnDespawned called by pool manager
void OnDespawned()
{
// Reset frame counter
frameNo = 0;
// Clear timer
if (FrameTimerID != -1)
{
F3DTime.time.RemoveTimer(FrameTimerID);
FrameTimerID = -1;
} }
} }
@ -81,142 +89,124 @@ namespace FORGE3D
// Calculate default beam proportion multiplier based on default scale and maximum length // Calculate default beam proportion multiplier based on default scale and maximum length
float propMult = MaxBeamLength * (beamScale / 10f); float propMult = MaxBeamLength * (beamScale / 10f);
// Raycast // Raycast
if (Physics.Raycast(ray, out hitPoint, MaxBeamLength, layerMask)) if (Physics.Raycast(ray, out hitPoint, MaxBeamLength, layerMask)
{ && DetectorCollision(hitPoint) != OwnerId)
// Get current beam length and update line renderer accordingly {
beamLength = Vector3.Distance(transform.position, hitPoint.point); // Get current beam length and update line renderer accordingly
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength)); beamLength = Vector3.Distance(transform.position, hitPoint.point);
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Calculate default beam proportion multiplier based on default scale and current length // Calculate default beam proportion multiplier based on default scale and current length
propMult = beamLength * (beamScale / 10f); propMult = beamLength * (beamScale / 10f);
// Spawn prefabs and apply force // Spawn prefabs and apply force
switch (fxType) switch (fxType)
{ {
case F3DFXType.Sniper: case WeaponEffect.Sniper:
F3DFXController.instance.SniperImpact(hitPoint.point + hitPoint.normal * fxOffset); F3DFXController.instance.SniperImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(4f); break;
break;
case F3DFXType.RailGun: case WeaponEffect.RailGun:
F3DFXController.instance.RailgunImpact(hitPoint.point + hitPoint.normal * fxOffset); F3DFXController.instance.RailgunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(7f); break;
break;
case F3DFXType.PlasmaBeam: case WeaponEffect.PlasmaBeam:
ApplyForce(0.5f); break;
break;
case F3DFXType.PlasmaBeamHeavy: case WeaponEffect.PlasmaBeamHeavy:
ApplyForce(2f); break;
break; }
}
// Adjust impact effect position // Adjust impact effect position
if (rayImpact) if (rayImpact)
rayImpact.position = hitPoint.point - transform.forward * 0.5f; rayImpact.position = hitPoint.point - transform.forward * 0.5f;
} }
//checking in 2d mode else
else {
{ // Set beam to maximum length
RaycastHit2D ray2D = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y), beamLength = MaxBeamLength;
new Vector2(transform.forward.x, transform.forward.y), beamLength, layerMask); lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
if (ray2D)
{
// Get current beam length and update line renderer accordingly
beamLength = Vector3.Distance(transform.position, ray2D.point);
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Calculate default beam proportion multiplier based on default scale and current length // Adjust impact effect position
propMult = beamLength * (beamScale / 10f); if (rayImpact)
// Spawn prefabs and apply force rayImpact.position = transform.position + transform.forward * beamLength;
switch (fxType) }
{
case F3DFXType.Sniper:
F3DFXController.instance.SniperImpact(ray2D.point + ray2D.normal * fxOffset); // Adjust muzzle position
ApplyForce(4f); if (rayMuzzle)
break; rayMuzzle.position = transform.position + transform.forward * 0.1f;
case F3DFXType.RailGun: // Set beam scaling according to its length
F3DFXController.instance.RailgunImpact(ray2D.point + ray2D.normal * fxOffset); lineRenderer.material.SetTextureScale("_BaseMap", new Vector2(propMult, 1f));
ApplyForce(7f); }
break;
case F3DFXType.PlasmaBeam: /// <summary>
ApplyForce(0.5f); /// Checks if a HitDetector was hit and registers a hit
break; /// on it if so.
/// </summary>
/// <param name="hitPoint"></param>
/// <returns>OwnerId of the hit detector (-1 on none)</returns>
int DetectorCollision(RaycastHit hitPoint)
{
if (hitPoint.collider.gameObject.TryGetComponent(out HitDetection detector))
{
// Check if the one firing was hit
if (detector.OwnerId == OwnerId)
{
return OwnerId;
}
case F3DFXType.PlasmaBeamHeavy: ProjectileDamage inflictling = new()
ApplyForce(2f); {
break; DamageValue = Damage,
} ImpactMagnitude = BlastMagnitude,
ImpactPoint = hitPoint.point,
ImpactDirection = transform.forward
};
detector.RegisterHit(inflictling);
return detector.OwnerId;
}
return -1;
}
// Adjust impact effect position // Advance texture frame
if (rayImpact) void OnFrameStep()
rayImpact.position = new Vector3(ray2D.point.x, {
ray2D.point.y, // Set current texture frame based on frame counter
this.gameObject.transform.position.z) - transform.forward * 0.5f; lineRenderer.material.mainTexture = BeamFrames[frameNo];
} frameNo++;
// Nothing was his
else
{
// Set beam to maximum length
beamLength = MaxBeamLength;
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Adjust impact effect position // Reset frame counter
if (rayImpact) if (frameNo == BeamFrames.Length)
rayImpact.position = transform.position + transform.forward * beamLength; frameNo = 0;
} }
}
// Adjust muzzle position // Initialize frame animation
if (rayMuzzle) void Animate()
rayMuzzle.position = transform.position + transform.forward * 0.1f; {
if (BeamFrames.Length > 1)
{
// Set current frame
frameNo = 0;
lineRenderer.material.mainTexture = BeamFrames[frameNo];
// Set beam scaling according to its length // Add timer
lineRenderer.material.SetTextureScale("_BaseMap", new Vector2(propMult, 1f)); FrameTimerID = F3DTime.time.AddTimer(FrameStep, BeamFrames.Length - 1, OnFrameStep);
}
// Advance texture frame frameNo = 1;
void OnFrameStep() }
{ }
// Set current texture frame based on frame counter
lineRenderer.material.mainTexture = BeamFrames[frameNo];
frameNo++;
// Reset frame counter // Apply force to last hit object
if (frameNo == BeamFrames.Length) void ApplyForce(float force)
frameNo = 0; {
} if (hitPoint.rigidbody != null)
hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point,
ForceMode.VelocityChange);
}
// Initialize frame animation // Set offset of impact
void Animate() public void SetOffset(float offset)
{
if (BeamFrames.Length > 1)
{
// Set current frame
frameNo = 0;
lineRenderer.material.mainTexture = BeamFrames[frameNo];
// Add timer
FrameTimerID = F3DTime.time.AddTimer(FrameStep, BeamFrames.Length - 1, OnFrameStep);
frameNo = 1;
}
}
// Apply force to last hit object
void ApplyForce(float force)
{
if (hitPoint.rigidbody != null)
hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point,
ForceMode.VelocityChange);
}
// Set offset of impact
public void SetOffset(float offset)
{ {
fxOffset = offset; fxOffset = offset;
} }

View File

@ -1,75 +1,78 @@
using UnityEngine; using UnityEngine;
using System.Collections;
using System; using System;
using System.Linq; using System.Linq;
namespace FORGE3D namespace FORGE3D
{ {
// Weapon types // Weapon types
public enum F3DFXType public enum WeaponEffect
{ {
Vulcan, Vulcan,
SoloGun, SoloGun,
Sniper, Sniper,
ShotGun, ShotGun,
Seeker, Seeker,
RailGun, RailGun,
PlasmaGun, PlasmaGun,
PlasmaBeam, PlasmaBeam,
PlasmaBeamHeavy, PlasmaBeamHeavy,
LightningGun, LightningGun,
FlameRed, FlameRed,
LaserImpulse LaserImpulse,
} None
}
public class F3DFXController : MonoBehaviour public class F3DFXController : MonoBehaviour
{ {
// Singleton instance // Singleton instance
public static F3DFXController instance; public static F3DFXController instance;
// Current firing socket // Current firing socket
private int curSocket = 0; private int curSocket = 0;
// Timer reference // Timer reference
private int timerID = -1; private int timerID = -1;
[Header("Turret setup")] public Transform[] TurretSocket; // Sockets reference
public ParticleSystem[] ShellParticles; // Bullet shells particle system
public F3DFXType DefaultFXType; // Default starting weapon type [Header("Turret setup")] public Transform[] TurretSocket; // Sockets reference
public ParticleSystem[] ShellParticles; // Bullet shells particle system
[Header("Vulcan")] public Transform vulcanProjectile; // Projectile prefab public WeaponEffect SelectedWeaponEffect; // Default starting weapon type
public Transform vulcanMuzzle; // Muzzle flash prefab
public Transform vulcanImpact; // Impact prefab
public float vulcanOffset;
public float VulcanFireRate = 0.07f; [Header("Vulcan")] public Transform vulcanProjectile; // Projectile prefab
public Transform vulcanMuzzle; // Muzzle flash prefab
public Transform vulcanImpact; // Impact prefab
public float vulcanOffset;
public float VulcanFireRate = 0.07f;
[Header("Solo gun")] public Transform soloGunProjectile; [Header("Solo gun")] public Transform soloGunProjectile;
public Transform soloGunMuzzle; public Transform soloGunMuzzle;
public Transform soloGunImpact; public Transform soloGunImpact;
public float soloGunOffset; public float soloGunOffset;
public float SoloGunFireRate = 0.3f;
[Header("Sniper")] public Transform sniperBeam; [Header("Sniper")] public Transform sniperBeam;
public Transform sniperMuzzle; public Transform sniperMuzzle;
public Transform sniperImpact; public Transform sniperImpact;
public float sniperOffset; public float sniperOffset;
[Header("Shotgun")] public Transform shotGunProjectile; [Header("Shotgun")] public Transform shotGunProjectile;
public Transform shotGunMuzzle; public Transform shotGunMuzzle;
public Transform shotGunImpact; public Transform shotGunImpact;
public float shotGunOffset; public float shotGunOffset;
[Header("Seeker")] public Transform seekerProjectile; [Header("Seeker")] public Transform seekerProjectile;
public Transform seekerMuzzle; public Transform seekerMuzzle;
public Transform seekerImpact; public Transform seekerImpact;
public float seekerOffset; public float seekerOffset;
public float SeekerFireRate = 0.5f;
[Header("Rail gun")] public Transform railgunBeam; [Header("Rail gun")] public Transform railgunBeam;
public Transform railgunMuzzle; public Transform railgunMuzzle;
public Transform railgunImpact; public Transform railgunImpact;
public float railgunOffset; public float railgunOffset;
public float RailGunFireRate = 1f;
[Header("Plasma gun")] public Transform plasmagunProjectile; [Header("Plasma gun")] public Transform plasmagunProjectile;
public Transform plasmagunMuzzle; public Transform plasmagunMuzzle;
@ -81,264 +84,275 @@ namespace FORGE3D
[Header("Plasma beam heavy")] public Transform plasmaBeamHeavy; [Header("Plasma beam heavy")] public Transform plasmaBeamHeavy;
public float plasmaBeamHeavyOffset; public float plasmaBeamHeavyOffset;
private AudioSource plasmaBeamLoopAudio;
[Header("Lightning gun")] public Transform lightningGunBeam; [Header("Lightning gun")] public Transform lightningGunBeam;
public float lightingGunBeamOffset; public float lightingGunBeamOffset;
[Header("Flame")] public Transform flameRed; [Header("Flame")] public Transform flameRed;
public float flameOffset; public float flameOffset;
[Header("Laser impulse")] public Transform laserImpulseProjectile; [Header("Laser impulse")] public Transform laserImpulseProjectile;
public Transform laserImpulseMuzzle; public Transform laserImpulseMuzzle;
public Transform laserImpulseImpact; public Transform laserImpulseImpact;
public float laserImpulseOffset; public float laserImpulseOffset;
public float LaserImpulseFireRate = 0.08f;
private void Awake() //Owner of this weapon system
{ private int _ownerId = 0;
// Initialize singleton
instance = this;
// Initialize bullet shells particles private void Awake()
for (int i = 0; i < ShellParticles.Length; i++) {
{ _ownerId = gameObject.GetInstanceID();
var em = ShellParticles[i].emission; // Initialize singleton
em.enabled = false; instance = this;
ShellParticles[i].Stop();
ShellParticles[i].gameObject.SetActive(true); // Initialize bullet shells particles
} for (int i = 0; i < ShellParticles.Length; i++)
} {
var em = ShellParticles[i].emission;
em.enabled = false;
ShellParticles[i].Stop();
ShellParticles[i].gameObject.SetActive(true);
}
}
// Switch to next weapon type // Switch to next weapon type
public void NextWeapon() public void NextWeapon()
{ {
if ((int) DefaultFXType < Enum.GetNames(typeof(F3DFXType)).Length - 1) if ((int)SelectedWeaponEffect < Enum.GetNames(typeof(WeaponEffect)).Length - 1)
{ {
DefaultFXType++; SelectedWeaponEffect++;
} }
} }
// Switch to previous weapon type // Switch to previous weapon type
public void PrevWeapon() public void PrevWeapon()
{ {
if (DefaultFXType > 0) if (SelectedWeaponEffect > 0)
{ {
DefaultFXType--; SelectedWeaponEffect--;
} }
} }
// Advance to next turret socket // Advance to next turret socket
private void AdvanceSocket() private void AdvanceSocket()
{ {
curSocket++; curSocket++;
if (curSocket >= TurretSocket.Length) if (curSocket >= TurretSocket.Length)
curSocket = 0; curSocket = 0;
} }
// Fire turret weapon // Fire turret weapon
public void Fire() public void Fire()
{ {
switch (DefaultFXType) switch (SelectedWeaponEffect)
{ {
case F3DFXType.Vulcan: case WeaponEffect.Vulcan:
// Fire vulcan at specified rate until canceled // Fire vulcan at specified rate until canceled
timerID = F3DTime.time.AddTimer(VulcanFireRate, Vulcan); timerID = F3DTime.time.AddTimer(VulcanFireRate, Vulcan);
// Invoke manually before the timer ticked to avoid initial delay // Invoke manually before the timer ticked to avoid initial delay
Vulcan(); Vulcan();
break; break;
case F3DFXType.SoloGun: case WeaponEffect.SoloGun:
timerID = F3DTime.time.AddTimer(0.2f, SoloGun); timerID = F3DTime.time.AddTimer(SoloGunFireRate, SoloGun);
SoloGun(); SoloGun();
break; break;
case F3DFXType.Sniper: case WeaponEffect.Sniper:
timerID = F3DTime.time.AddTimer(0.3f, Sniper); timerID = F3DTime.time.AddTimer(0.3f, Sniper);
Sniper(); Sniper();
break; break;
case F3DFXType.ShotGun: case WeaponEffect.ShotGun:
timerID = F3DTime.time.AddTimer(0.3f, ShotGun); timerID = F3DTime.time.AddTimer(0.3f, ShotGun);
ShotGun(); ShotGun();
break; break;
case F3DFXType.Seeker: case WeaponEffect.Seeker:
timerID = F3DTime.time.AddTimer(0.2f, Seeker); timerID = F3DTime.time.AddTimer(SeekerFireRate, Seeker);
Seeker(); Seeker();
break; break;
case F3DFXType.RailGun: case WeaponEffect.RailGun:
timerID = F3DTime.time.AddTimer(0.2f, RailGun); timerID = F3DTime.time.AddTimer(RailGunFireRate, RailGun);
RailGun(); RailGun();
break; break;
case F3DFXType.PlasmaGun: case WeaponEffect.PlasmaGun:
timerID = F3DTime.time.AddTimer(0.2f, PlasmaGun); timerID = F3DTime.time.AddTimer(0.2f, PlasmaGun);
PlasmaGun(); PlasmaGun();
break; break;
case F3DFXType.PlasmaBeam: case WeaponEffect.PlasmaBeam:
// Beams has no timer requirement // Beams has no timer requirement
PlasmaBeam(); PlasmaBeam();
break; break;
case F3DFXType.PlasmaBeamHeavy: case WeaponEffect.PlasmaBeamHeavy:
// Beams has no timer requirement // Beams has no timer requirement
PlasmaBeamHeavy(); PlasmaBeamHeavy();
break; break;
case F3DFXType.LightningGun: case WeaponEffect.LightningGun:
// Beams has no timer requirement // Beams has no timer requirement
LightningGun(); LightningGun();
break; break;
case F3DFXType.FlameRed: case WeaponEffect.FlameRed:
// Flames has no timer requirement // Flames has no timer requirement
FlameRed(); FlameRed();
break; break;
case F3DFXType.LaserImpulse: case WeaponEffect.LaserImpulse:
timerID = F3DTime.time.AddTimer(0.15f, LaserImpulse); timerID = F3DTime.time.AddTimer(LaserImpulseFireRate, LaserImpulse);
LaserImpulse(); LaserImpulse();
break; break;
} }
} }
// Stop firing // Stop firing
public void Stop() public void Stop()
{ {
// Remove firing timer // Remove firing timer
if (timerID != -1) if (timerID != -1)
{ {
F3DTime.time.RemoveTimer(timerID); F3DTime.time.RemoveTimerNextTick(timerID);
timerID = -1; timerID = -1;
} }
switch (DefaultFXType) switch (SelectedWeaponEffect)
{ {
case F3DFXType.PlasmaBeam: case WeaponEffect.PlasmaBeam:
F3DAudioController.instance.PlasmaBeamClose(transform.position); F3DAudioController.instance.PlasmaBeamClose(transform.position);
break; break;
case F3DFXType.PlasmaBeamHeavy: case WeaponEffect.PlasmaBeamHeavy:
F3DAudioController.instance.PlasmaBeamHeavyClose(transform.position); StopPlasmaBeamHeavy();
break; F3DAudioController.instance.PlasmaBeamHeavyClose(transform.position);
if (plasmaBeamLoopAudio == null) break;
F3DPoolManager.Pools["GeneratedPool"].Despawn(plasmaBeamLoopAudio.gameObject.transform);
break;
case F3DFXType.LightningGun: case WeaponEffect.LightningGun:
F3DAudioController.instance.LightningGunClose(transform.position); F3DAudioController.instance.LightningGunClose(transform.position);
break; break;
case F3DFXType.FlameRed: case WeaponEffect.FlameRed:
F3DAudioController.instance.FlameGunClose(transform.position); F3DAudioController.instance.FlameGunClose(transform.position);
break; break;
} }
} }
// Fire vulcan weapon // Fire vulcan weapon
private void Vulcan() private void Vulcan()
{ {
// Get random rotation that offset spawned projectile // Get random rotation that offset spawned projectile
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere); var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
// Spawn muzzle flash and projectile with the rotation offset at current socket position // Spawn muzzle flash and projectile with the rotation offset at current socket position
F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanMuzzle, TurretSocket[curSocket].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]); TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO = var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanProjectile, F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanProjectile,
TurretSocket[curSocket].position + TurretSocket[curSocket].forward, TurretSocket[curSocket].position + TurretSocket[curSocket].forward,
offset * TurretSocket[curSocket].rotation, null).gameObject; offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGO.gameObject.GetComponent<F3DProjectile>(); var proj = newGO.gameObject.GetComponent<F3DProjectile>();
if (proj) if (proj)
{ {
proj.SetOffset(vulcanOffset); proj.SetOffset(vulcanOffset);
} proj.OwnerId = _ownerId;
}
// Emit one bullet shell // Emit one bullet shell
if (ShellParticles.Length > 0) if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1); ShellParticles[curSocket].Emit(1);
// Play shot sound effect // Play shot sound effect
F3DAudioController.instance.VulcanShot(TurretSocket[curSocket].position); F3DAudioController.instance.VulcanShot(TurretSocket[curSocket].position);
// Advance to next turret socket // Advance to next turret socket
AdvanceSocket(); AdvanceSocket();
} }
// Spawn vulcan weapon impact // Spawn vulcan weapon impact
public void VulcanImpact(Vector3 pos) public void VulcanImpact(Vector3 pos)
{ {
// Spawn impact prefab at specified position // Spawn impact prefab at specified position
F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanImpact, pos, Quaternion.identity, null); F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanImpact, pos, Quaternion.identity, null);
// Play impact sound effect // Play impact sound effect
F3DAudioController.instance.VulcanHit(pos); F3DAudioController.instance.VulcanHit(pos);
} }
// Fire sologun weapon // Fire sologun weapon
private void SoloGun() private void SoloGun()
{ {
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere); var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunMuzzle, TurretSocket[curSocket].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]); TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO = var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunProjectile, F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunProjectile,
TurretSocket[curSocket].position + TurretSocket[curSocket].forward, TurretSocket[curSocket].position + TurretSocket[curSocket].forward,
offset * TurretSocket[curSocket].rotation, null).gameObject; offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGO.GetComponent<F3DProjectile>(); var proj = newGO.GetComponent<F3DProjectile>();
if (proj) if (proj)
{ {
proj.SetOffset(soloGunOffset); proj.SetOffset(soloGunOffset);
} proj.OwnerId = _ownerId;
}
F3DAudioController.instance.SoloGunShot(TurretSocket[curSocket].position); F3DAudioController.instance.SoloGunShot(TurretSocket[curSocket].position);
AdvanceSocket(); AdvanceSocket();
} }
// Spawn sologun weapon impact // Spawn sologun weapon impact
public void SoloGunImpact(Vector3 pos) public void SoloGunImpact(Vector3 pos)
{ {
F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunImpact, pos, Quaternion.identity, null); F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.SoloGunHit(pos); F3DAudioController.instance.SoloGunHit(pos);
} }
// Fire sniper weapon // Fire sniper weapon
private void Sniper() private void Sniper()
{ {
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere); var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperMuzzle, TurretSocket[curSocket].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]); TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO = var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperBeam, TurretSocket[curSocket].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperBeam, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null).gameObject; offset * TurretSocket[curSocket].rotation, null).gameObject;
var beam = newGO.GetComponent<F3DBeam>(); var beam = newGO.GetComponent<F3DBeam>();
if (beam) if (beam)
{ {
beam.SetOffset(sniperOffset); beam.SetOffset(sniperOffset);
} }
F3DAudioController.instance.SniperShot(TurretSocket[curSocket].position); F3DAudioController.instance.SniperShot(TurretSocket[curSocket].position);
if (ShellParticles.Length > 0) if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1); ShellParticles[curSocket].Emit(1);
AdvanceSocket(); AdvanceSocket();
} }
// Spawn sniper weapon impact // Spawn sniper weapon impact
public void SniperImpact(Vector3 pos) public void SniperImpact(Vector3 pos)
{ {
F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperImpact, pos, Quaternion.identity, null); F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.SniperHit(pos); F3DAudioController.instance.SniperHit(pos);
} }
// Fire shotgun weapon // Fire shotgun weapon
private void ShotGun() private void ShotGun()
{ {
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere); var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(shotGunMuzzle, TurretSocket[curSocket].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(shotGunMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]); TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
F3DPoolManager.Pools["GeneratedPool"].Spawn(shotGunProjectile, TurretSocket[curSocket].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(shotGunProjectile, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null); offset * TurretSocket[curSocket].rotation, null);
F3DAudioController.instance.ShotGunShot(TurretSocket[curSocket].position); F3DAudioController.instance.ShotGunShot(TurretSocket[curSocket].position);
if (ShellParticles.Length > 0) if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1); ShellParticles[curSocket].Emit(1);
AdvanceSocket(); AdvanceSocket();
} }
@ -362,6 +376,7 @@ namespace FORGE3D
if (proj) if (proj)
{ {
proj.SetOffset(seekerOffset); proj.SetOffset(seekerOffset);
proj.OwnerId = _ownerId;
} }
F3DAudioController.instance.SeekerShot(TurretSocket[curSocket].position); F3DAudioController.instance.SeekerShot(TurretSocket[curSocket].position);
@ -390,7 +405,8 @@ namespace FORGE3D
if (beam) if (beam)
{ {
beam.SetOffset(railgunOffset); beam.SetOffset(railgunOffset);
} beam.OwnerId = _ownerId;
}
F3DAudioController.instance.RailGunShot(TurretSocket[curSocket].position); F3DAudioController.instance.RailGunShot(TurretSocket[curSocket].position);
if (ShellParticles.Length > 0) if (ShellParticles.Length > 0)
@ -418,64 +434,76 @@ namespace FORGE3D
if (proj) if (proj)
{ {
proj.SetOffset(plasmaOffset); proj.SetOffset(plasmaOffset);
} proj.OwnerId = _ownerId;
}
F3DAudioController.instance.PlasmaGunShot(TurretSocket[curSocket].position); F3DAudioController.instance.PlasmaGunShot(TurretSocket[curSocket].position);
AdvanceSocket(); AdvanceSocket();
} }
// Spawn plasma gun weapon impact // Spawn plasma gun weapon impact
public void PlasmaGunImpact(Vector3 pos) public void PlasmaGunImpact(Vector3 pos)
{ {
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmagunImpact, pos, Quaternion.identity, null); F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmagunImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.PlasmaGunHit(pos); F3DAudioController.instance.PlasmaGunHit(pos);
} }
// Fire plasma beam weapon // Fire plasma beam weapon
private void PlasmaBeam() private void PlasmaBeam()
{ {
for (var i = 0; i < TurretSocket.Length; i++) for (var i = 0; i < TurretSocket.Length; i++)
{ {
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmaBeam, TurretSocket[i].position, F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmaBeam, TurretSocket[i].position,
TurretSocket[i].rotation, TurretSocket[i].rotation,
TurretSocket[i]); TurretSocket[i]);
} }
F3DAudioController.instance.PlasmaBeamLoop(transform.position, transform.parent); F3DAudioController.instance.PlasmaBeamLoop(transform.position, transform.parent);
} }
// Fire heavy beam weapon private void StopPlasmaBeamHeavy()
private void PlasmaBeamHeavy() {
{ for (var i = 0; i < TurretSocket.Length; i++)
for (var i = 0; i < TurretSocket.Length; i++) {
{ foreach (Transform child in TurretSocket[i])
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmaBeamHeavy, TurretSocket[i].position, {
TurretSocket[i].rotation, F3DPoolManager.Pools["GeneratedPool"].Despawn(child, plasmaBeamHeavy);
TurretSocket[i]); }
} }
}
F3DAudioController.instance.PlasmaBeamHeavyLoop(transform.position, transform.parent); // Fire heavy beam weapon
} private void PlasmaBeamHeavy()
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmaBeamHeavy, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
// Fire lightning gun weapon plasmaBeamLoopAudio = F3DAudioController.instance.PlasmaBeamHeavyLoop(transform.position, transform.parent);
private void LightningGun() }
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(lightningGunBeam, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
F3DAudioController.instance.LightningGunLoop(transform.position, transform); // Fire lightning gun weapon
} private void LightningGun()
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(lightningGunBeam, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
// Fire flames weapon F3DAudioController.instance.LightningGunLoop(transform.position, transform);
private void FlameRed() }
{
for (var i = 0; i < TurretSocket.Length; i++) // Fire flames weapon
{ private void FlameRed()
F3DPoolManager.Pools["GeneratedPool"].Spawn(flameRed, TurretSocket[i].position, {
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(flameRed, TurretSocket[i].position,
TurretSocket[i].rotation, TurretSocket[i].rotation,
TurretSocket[i]); TurretSocket[i]);
} }
@ -496,18 +524,19 @@ namespace FORGE3D
if (proj) if (proj)
{ {
proj.SetOffset(laserImpulseOffset); proj.SetOffset(laserImpulseOffset);
} proj.OwnerId = _ownerId;
}
F3DAudioController.instance.LaserImpulseShot(TurretSocket[curSocket].position); F3DAudioController.instance.LaserImpulseShot(TurretSocket[curSocket].position);
AdvanceSocket(); AdvanceSocket();
} }
// Spawn laser pulse weapon impact // Spawn laser pulse weapon impact
public void LaserImpulseImpact(Vector3 pos) public void LaserImpulseImpact(Vector3 pos)
{ {
F3DPoolManager.Pools["GeneratedPool"].Spawn(laserImpulseImpact, pos, Quaternion.identity, null); F3DPoolManager.Pools["GeneratedPool"].Spawn(laserImpulseImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.LaserImpulseHit(pos); F3DAudioController.instance.LaserImpulseHit(pos);
} }
} }
} }

View File

@ -3,223 +3,258 @@ using System.Collections;
namespace FORGE3D namespace FORGE3D
{ {
[RequireComponent(typeof (LineRenderer))] [RequireComponent(typeof(LineRenderer))]
public class F3DLightning : MonoBehaviour public class F3DLightning : MonoBehaviour
{ {
public LayerMask layerMask; public LayerMask layerMask;
public Texture[] BeamFrames; // Animation frame sequence public Texture[] BeamFrames; // Animation frame sequence
public float FrameStep; // Animation time public float FrameStep; // Animation time
public bool RandomizeFrames; // Randomization of animation frames public bool RandomizeFrames; // Randomization of animation frames
public int Points; // How many points should be used to construct the beam public int Points; // How many points should be used to construct the beam
public float MaxBeamLength; // Maximum beam length public float MaxBeamLength; // Maximum beam length
public float beamScale; // Default beam scale to be kept over distance public float beamScale; // Default beam scale to be kept over distance
public bool AnimateUV; // UV Animation public bool AnimateUV; // UV Animation
public float UVTime; // UV Animation speed public float UVTime; // UV Animation speed
public bool Oscillate; // Beam oscillation flag public bool Oscillate; // Beam oscillation flag
public float Amplitude; // Beam amplitude public float Amplitude; // Beam amplitude
public float OscillateTime; // Beam oscillation rate public float OscillateTime; // Beam oscillation rate
public Transform rayImpact; // Impact transform public Transform rayImpact; // Impact transform
public Transform rayMuzzle; // Muzzle flash transform public Transform rayMuzzle; // Muzzle flash transform
LineRenderer lineRenderer; // Line rendered component [Tooltip("The amount of damage this projectil inflicts generally.")]
RaycastHit hitPoint; // Raycast structure public float damage = 10f;
[Tooltip("The magnitude of the blast when hitting something.")]
public float blastMagnitude = 1f;
int frameNo; // Frame counter [HideInInspector]
int FrameTimerID; // Frame timer reference public int OwnerId = 0;
int OscillateTimerID; // Beam oscillation timer reference
float beamLength; // Current beam length LineRenderer lineRenderer; // Line rendered component
float initialBeamOffset; // Initial UV offset RaycastHit hitPoint; // Raycast structure
void Awake() int frameNo; // Frame counter
{ int FrameTimerID; // Frame timer reference
// Get line renderer component int OscillateTimerID; // Beam oscillation timer reference
lineRenderer = GetComponent<LineRenderer>();
// Assign first frame texture float beamLength; // Current beam length
if (!AnimateUV && BeamFrames.Length > 0) float initialBeamOffset; // Initial UV offset
lineRenderer.material.mainTexture = BeamFrames[0];
// Randomize uv offset void Awake()
initialBeamOffset = Random.Range(0f, 5f); {
} // Get line renderer component
lineRenderer = GetComponent<LineRenderer>();
// OnSpawned called by pool manager // Assign first frame texture
void OnSpawned() if (!AnimateUV && BeamFrames.Length > 0)
{ lineRenderer.material.mainTexture = BeamFrames[0];
// Start animation sequence if beam frames array has more than 2 elements
if (BeamFrames.Length > 1)
Animate();
// Start oscillation sequence // Randomize uv offset
if (Oscillate && Points > 0) initialBeamOffset = Random.Range(0f, 5f);
OscillateTimerID = F3DTime.time.AddTimer(OscillateTime, OnOscillate); }
} // OnSpawned called by pool manager
void OnSpawned()
{
// Start animation sequence if beam frames array has more than 2 elements
if (BeamFrames.Length > 1)
Animate();
// OnDespawned called by pool manager // Start oscillation sequence
void OnDespawned() if (Oscillate && Points > 0)
{ OscillateTimerID = F3DTime.time.AddTimer(OscillateTime, OnOscillate);
// Reset frame counter
frameNo = 0;
// Clear frame animation timer }
if (FrameTimerID != -1)
{
F3DTime.time.RemoveTimer(FrameTimerID);
FrameTimerID = -1;
}
// Clear oscillation timer // OnDespawned called by pool manager
if (OscillateTimerID != -1) void OnDespawned()
{ {
F3DTime.time.RemoveTimer(OscillateTimerID); // Reset frame counter
OscillateTimerID = -1; frameNo = 0;
}
}
// Hit point calculation // Clear frame animation timer
void Raycast() if (FrameTimerID != -1)
{ {
// Prepare structure and create ray F3DTime.time.RemoveTimer(FrameTimerID);
hitPoint = new RaycastHit(); FrameTimerID = -1;
Ray ray = new Ray(transform.position, transform.forward); }
// Calculate default beam proportion multiplier based on default scale and maximum length // Clear oscillation timer
float propMult = MaxBeamLength*(beamScale/10f); if (OscillateTimerID != -1)
{
F3DTime.time.RemoveTimer(OscillateTimerID);
OscillateTimerID = -1;
}
}
// Raycast // Hit point calculation
if (Physics.Raycast(ray, out hitPoint, MaxBeamLength, layerMask)) void Raycast()
{ {
// Get current beam length // Prepare structure and create ray
beamLength = Vector3.Distance(transform.position, hitPoint.point); hitPoint = new RaycastHit();
Ray ray = new Ray(transform.position, transform.forward);
// Update line renderer // Calculate default beam proportion multiplier based on default scale and maximum length
if (!Oscillate) float propMult = MaxBeamLength * (beamScale / 10f);
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Calculate default beam proportion multiplier based on default scale and current length // Raycast
propMult = beamLength*(beamScale/10f); if (Physics.Raycast(ray, out hitPoint, MaxBeamLength, layerMask)
&& DetectorCollision(hitPoint) != OwnerId)
{
// Get current beam length
beamLength = Vector3.Distance(transform.position, hitPoint.point);
// Apply hit force to rigidbody // Update line renderer
ApplyForce(0.1f); if (!Oscillate)
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Adjust impact effect position // Calculate default beam proportion multiplier based on default scale and current length
if (rayImpact) propMult = beamLength * (beamScale / 10f);
rayImpact.position = hitPoint.point - transform.forward*0.5f;
}
// Nothing was his // Adjust impact effect position
else if (rayImpact)
{ rayImpact.position = hitPoint.point - transform.forward * 0.5f;
// Set beam to maximum length }
beamLength = MaxBeamLength;
// Update beam length // Nothing was his
if (!Oscillate) else
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength)); {
// Set beam to maximum length
beamLength = MaxBeamLength;
// Adjust impact effect position // Update beam length
if (rayImpact) if (!Oscillate)
rayImpact.position = transform.position + transform.forward*beamLength; lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
}
// Adjust muzzle position // Adjust impact effect position
if (rayMuzzle) if (rayImpact)
rayMuzzle.position = transform.position + transform.forward*0.1f; rayImpact.position = transform.position + transform.forward * beamLength;
}
// Set beam scaling according to its length // Adjust muzzle position
lineRenderer.material.SetTextureScale("_BaseMap", new Vector2(propMult, 1f)); if (rayMuzzle)
} rayMuzzle.position = transform.position + transform.forward * 0.1f;
// Generate random noise numbers based on amplitude // Set beam scaling according to its length
float GetRandomNoise() lineRenderer.material.SetTextureScale("_BaseMap", new Vector2(propMult, 1f));
{ }
return Random.Range(-Amplitude, Amplitude);
}
// Advance texture frame /// <summary>
void OnFrameStep() /// Checks if a HitDetector was hit and registers a hit
{ /// on it if so.
// Randomize frame counter /// </summary>
if (RandomizeFrames) /// <param name="hitPoint"></param>
frameNo = Random.Range(0, BeamFrames.Length); /// <returns>OwnerId of the hit detector (-1 on none)</returns>
int DetectorCollision(RaycastHit hitPoint)
{
if (hitPoint.collider.gameObject.TryGetComponent(out HitDetection detector))
{
// Check if the one firing was hit
if (detector.OwnerId == OwnerId)
{
return OwnerId;
}
// Set current texture frame based on frame counter ProjectileDamage inflictling = new()
lineRenderer.material.mainTexture = BeamFrames[frameNo]; {
frameNo++; DamageValue = damage,
ImpactMagnitude = blastMagnitude,
ImpactPoint = hitPoint.point,
ImpactDirection = transform.forward
};
detector.RegisterHit(inflictling);
return detector.OwnerId;
}
return -1;
}
// Reset frame counter // Generate random noise numbers based on amplitude
if (frameNo == BeamFrames.Length) float GetRandomNoise()
frameNo = 0; {
} return Random.Range(-Amplitude, Amplitude);
}
// Oscillate beam // Advance texture frame
void OnOscillate() void OnFrameStep()
{ {
// Calculate number of points based on beam length and default number of points // Randomize frame counter
int points = (int) ((beamLength/10f)*Points); if (RandomizeFrames)
frameNo = Random.Range(0, BeamFrames.Length);
// Update line rendered segments in case number of points less than 2 // Set current texture frame based on frame counter
if (points < 2) lineRenderer.material.mainTexture = BeamFrames[frameNo];
{ frameNo++;
// lineRenderer.SetVertexCount(2);
lineRenderer.positionCount = 2;
lineRenderer.SetPosition(0, Vector3.zero);
lineRenderer.SetPosition(1, new Vector3(0, 0, beamLength));
}
// Update line renderer segments
else
{
// Update number of points for line renderer
lineRenderer.positionCount = points;
// Set zero point manually
lineRenderer.SetPosition(0, Vector3.zero);
// Update each point with random noise based on amplitude // Reset frame counter
for (int i = 1; i < points - 1; i++) if (frameNo == BeamFrames.Length)
lineRenderer.SetPosition(i, frameNo = 0;
new Vector3(GetRandomNoise(), GetRandomNoise(), (beamLength/(points - 1))*i)); }
// Set last point manually // Oscillate beam
lineRenderer.SetPosition(points - 1, new Vector3(0f, 0f, beamLength)); void OnOscillate()
} {
} // Calculate number of points based on beam length and default number of points
int points = (int)((beamLength / 10f) * Points);
// Initialize frame animation // Update line rendered segments in case number of points less than 2
void Animate() if (points < 2)
{ {
// Set current frame // lineRenderer.SetVertexCount(2);
frameNo = 0; lineRenderer.positionCount = 2;
lineRenderer.material.mainTexture = BeamFrames[frameNo]; lineRenderer.SetPosition(0, Vector3.zero);
lineRenderer.SetPosition(1, new Vector3(0, 0, beamLength));
}
// Update line renderer segments
else
{
// Update number of points for line renderer
lineRenderer.positionCount = points;
// Set zero point manually
lineRenderer.SetPosition(0, Vector3.zero);
// Add timer // Update each point with random noise based on amplitude
FrameTimerID = F3DTime.time.AddTimer(FrameStep, OnFrameStep); for (int i = 1; i < points - 1; i++)
lineRenderer.SetPosition(i,
new Vector3(GetRandomNoise(), GetRandomNoise(), (beamLength / (points - 1)) * i));
frameNo = 1; // Set last point manually
} lineRenderer.SetPosition(points - 1, new Vector3(0f, 0f, beamLength));
}
}
// Apply force to last hit object // Initialize frame animation
void ApplyForce(float force) void Animate()
{ {
if (hitPoint.rigidbody != null) // Set current frame
hitPoint.rigidbody.AddForceAtPosition(transform.forward*force, hitPoint.point, ForceMode.VelocityChange); frameNo = 0;
} lineRenderer.material.mainTexture = BeamFrames[frameNo];
void Update() // Add timer
{ FrameTimerID = F3DTime.time.AddTimer(FrameStep, OnFrameStep);
// Animate texture UV
if (AnimateUV)
lineRenderer.material.SetVector("_Offset", new Vector2(Time.time*UVTime + initialBeamOffset, 0f));
// Process raycasting frameNo = 1;
Raycast(); }
}
} // Apply force to last hit object
void ApplyForce(float force)
{
if (hitPoint.rigidbody != null)
hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point, ForceMode.VelocityChange);
}
void Update()
{
// Animate texture UV
if (AnimateUV)
lineRenderer.material.SetVector("_Offset", new Vector2(Time.time * UVTime + initialBeamOffset, 0f));
// Process raycasting
Raycast();
}
}
} }

View File

@ -5,14 +5,23 @@ namespace FORGE3D
{ {
public class F3DProjectile : MonoBehaviour public class F3DProjectile : MonoBehaviour
{ {
public F3DFXType fxType; // Weapon type public WeaponEffect fxType; // Weapon type
public LayerMask layerMask; public LayerMask layerMask;
public float lifeTime = 5f; // Projectile life time
public float despawnDelay; // Delay despawn in ms [Tooltip("The amount of damage this projectil inflicts generally.")]
public float velocity = 300f; // Projectile velocity public float Damage = 10f;
public float RaycastAdvance = 2f; // Raycast advance multiplier
public bool DelayDespawn = false; // Projectile despawn flag [Tooltip("The magnitude of the blast when hitting something.")]
public ParticleSystem[] delayedParticles; // Array of delayed particles public float BlastMagnitude = 1f;
[HideInInspector]
public int OwnerId = 0;
public float LifeTime = 5f; // Projectile life time
public float despawnDelay; // Delay despawn in ms
public float velocity = 300f; // Projectile velocity
public float RaycastAdvance = 2f; // Raycast advance multiplier
public bool DelayDespawn = false; // Projectile despawn flag
public ParticleSystem[] delayedParticles; // Array of delayed particles
ParticleSystem[] particles; // Array of projectile particles ParticleSystem[] particles; // Array of projectile particles
new Transform transform; // Cached transform new Transform transform; // Cached transform
RaycastHit hitPoint; // Raycast structure RaycastHit hitPoint; // Raycast structure
@ -26,16 +35,17 @@ namespace FORGE3D
// Cache transform and get all particle systems attached // Cache transform and get all particle systems attached
transform = GetComponent<Transform>(); transform = GetComponent<Transform>();
particles = GetComponentsInChildren<ParticleSystem>(); particles = GetComponentsInChildren<ParticleSystem>();
}
// OnSpawned called by pool manager }
public void OnSpawned()
{ // OnSpawned called by pool manager
// Reset flags and raycast structure public void OnSpawned()
isHit = false; {
isFXSpawned = false; // Reset flags and raycast structure
timer = 0f; isHit = false;
hitPoint = new RaycastHit(); isFXSpawned = false;
timer = 0f;
hitPoint = new RaycastHit();
} }
@ -73,77 +83,81 @@ namespace FORGE3D
F3DPoolManager.Pools["GeneratedPool"].Despawn(transform); F3DPoolManager.Pools["GeneratedPool"].Despawn(transform);
} }
// Apply hit force on impact // TODO: for my purposes this is not enough control over this effect
void ApplyForce(float force) // I will have to implement HitDetectors for everything which can be hit
{ void ApplyForce(float force)
if (hitPoint.rigidbody != null) {
hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point, // if (hitPoint.rigidbody != null)
ForceMode.VelocityChange); // hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point,
} // ForceMode.VelocityChange);
}
void Update() void Update()
{ {
// If something was hit // If something was hit
if (isHit) if (isHit)
{ {
// Execute once // Execute once
if (!isFXSpawned) if (!isFXSpawned)
{ {
// Invoke corresponding method that spawns FX // Invoke corresponding method that spawns FX
switch (fxType) switch (fxType)
{
case F3DFXType.Vulcan:
F3DFXController.instance.VulcanImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(2.5f);
break;
case F3DFXType.SoloGun:
F3DFXController.instance.SoloGunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
case F3DFXType.Seeker:
F3DFXController.instance.SeekerImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(30f);
break;
case F3DFXType.PlasmaGun:
F3DFXController.instance.PlasmaGunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
case F3DFXType.LaserImpulse:
F3DFXController.instance.LaserImpulseImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
}
isFXSpawned = true;
}
// Despawn current projectile
if (!DelayDespawn || (DelayDespawn && (timer >= despawnDelay)))
OnProjectileDestroy();
}
// No collision occurred yet
else
{
// Projectile step per frame based on velocity and time
Vector3 step = transform.forward * Time.deltaTime * velocity;
// Raycast for targets with ray length based on frame step by ray cast advance multiplier
if (Physics.Raycast(transform.position, transform.forward, out hitPoint,
step.magnitude * RaycastAdvance,
layerMask))
{
isHit = true;
if (hitPoint.collider.gameObject.TryGetComponent(out HitFeedbackTestObjectBehavior obj))
{ {
obj.Hit(); case WeaponEffect.Vulcan:
F3DFXController.instance.VulcanImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(2.5f);
break;
case WeaponEffect.SoloGun:
F3DFXController.instance.SoloGunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
case WeaponEffect.Seeker:
F3DFXController.instance.SeekerImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(30f);
break;
case WeaponEffect.PlasmaGun:
F3DFXController.instance.PlasmaGunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
case WeaponEffect.LaserImpulse:
F3DFXController.instance.LaserImpulseImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
} }
isFXSpawned = true;
}
// Despawn current projectile
if (!DelayDespawn || (DelayDespawn && (timer >= despawnDelay)))
OnProjectileDestroy();
}
// No collision occurred yet
else
{
// Projectile step per frame based on velocity and time
Vector3 step = transform.forward * Time.deltaTime * velocity;
// Raycast for targets with ray length based on frame step by ray cast advance multiplier
if (Physics.Raycast(transform.position, transform.forward, out hitPoint,
step.magnitude * RaycastAdvance,
layerMask))
{
if (DetectorCollision(hitPoint) == OwnerId)
{
transform.position += 2 * step;
timer += Time.deltaTime;
return;
}
isHit = true;
// Invoke delay routine if required // Invoke delay routine if required
if (DelayDespawn) if (DelayDespawn)
{ {
@ -155,23 +169,52 @@ namespace FORGE3D
// Nothing hit // Nothing hit
else else
{ {
// Projectile despawn after run out of time // Projectile despawn after run out of time
if (timer >= lifeTime) if (timer >= LifeTime)
OnProjectileDestroy(); OnProjectileDestroy();
} }
// Advances projectile forward // Advances projectile forward
transform.position += step; transform.position += step;
} }
// Updates projectile timer // Updates projectile timer
timer += Time.deltaTime; timer += Time.deltaTime;
} }
//Set offset /// <summary>
public void SetOffset(float offset) /// Checks if a HitDetector was hit and registers a hit
{ /// on it if so.
fxOffset = offset; /// </summary>
} /// <param name="hitPoint"></param>
} /// <returns>OwnerId of the hit detector (-1 on none)</returns>
int DetectorCollision(RaycastHit hitPoint)
{
if (hitPoint.collider.gameObject.TryGetComponent(out HitDetection detector))
{
// Check if the one firing was hit
if (detector.OwnerId == OwnerId)
{
return OwnerId;
}
ProjectileDamage inflictling = new()
{
DamageValue = Damage,
ImpactMagnitude = BlastMagnitude,
ImpactPoint = hitPoint.point,
ImpactDirection = transform.forward
};
detector.RegisterHit(inflictling);
return detector.OwnerId;
}
return -1;
}
//Set offset
public void SetOffset(float offset)
{
fxOffset = offset;
}
}
} }

View File

@ -2,6 +2,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using System.Linq;
namespace FORGE3D namespace FORGE3D
{ {
@ -23,20 +24,21 @@ namespace FORGE3D
{ {
public int id; public int id;
public bool isActive; public bool isActive;
public bool removeNextTick = false;
public float rate; public float rate;
public int ticks; public int ticks;
public int ticksElapsed; public int ticksElapsed;
public float last; public float last;
public Action callBack; public Action callBack;
public Timer(int id_, float rate_, int ticks_, Action callback_) public Timer(int id_, float rate_, int ticks_, Action callback_)
{ {
id = id_; id = id_;
rate = rate_ < 0 ? 0 : rate_; rate = rate_ < 0 ? 0 : rate_;
ticks = ticks_ < 0 ? 0 : ticks_; ticks = ticks_ < 0 ? 0 : ticks_;
callBack = callback_; callBack = callback_;
last = 0; last = 0;
ticksElapsed = 0; ticksElapsed = 0;
isActive = true; isActive = true;
} }
@ -47,25 +49,32 @@ namespace FORGE3D
if (isActive && last >= rate) if (isActive && last >= rate)
{ {
last = 0; if (removeNextTick)
ticksElapsed++; {
callBack.Invoke(); isActive = false;
F3DTime.time.RemoveTimer(id);
return;
}
if (ticks > 0 && ticks == ticksElapsed) last = 0;
{ ticksElapsed++;
isActive = false; callBack.Invoke();
F3DTime.time.RemoveTimer(id);
}
}
}
}
/// <summary> if (ticks > 0 && ticks == ticksElapsed)
/// Awake {
/// </summary> isActive = false;
void Awake() F3DTime.time.RemoveTimer(id);
{ }
time = this; }
}
}
/// <summary>
/// Awake
/// </summary>
void Awake()
{
time = this;
timers = new List<Timer>(); timers = new List<Timer>();
removalPending = new List<int>(); removalPending = new List<int>();
} }
@ -104,18 +113,23 @@ namespace FORGE3D
removalPending.Add(timerId); removalPending.Add(timerId);
} }
/// <summary> public void RemoveTimerNextTick(int timerId)
/// Timer removal queue handler {
/// </summary> timers.First(t => t.id == timerId).removeNextTick = true;
void Remove() }
{
if (removalPending.Count > 0) /// <summary>
{ /// Timer removal queue handler
foreach (int id in removalPending) /// </summary>
for (int i = 0; i < timers.Count; i++) void Remove()
if (timers[i].id == id) {
{ if (removalPending.Count > 0)
timers.RemoveAt(i); {
foreach (int id in removalPending)
for (int i = 0; i < timers.Count; i++)
if (timers[i].id == id)
{
timers.RemoveAt(i);
break; break;
} }

View File

@ -31,8 +31,8 @@ namespace FORGE3D
void SetWeaponTypeText() void SetWeaponTypeText()
{ {
WeaponTypeText.text = _fxTypeName[(int) _fxControllers[0].DefaultFXType]; WeaponTypeText.text = _fxTypeName[(int)_fxControllers[0].SelectedWeaponEffect];
} }
public void OnButtonNext() public void OnButtonNext()
{ {

View File

@ -21,8 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Burnout_Heat_001 m_Name: Burnout_Heat_001
m_Shader: {fileID: -6465566751694194690, guid: a69f632f7605c4347b0ac15ec7b2d967, m_Shader: {fileID: -6465566751694194690, guid: a69f632f7605c4347b0ac15ec7b2d967, type: 3}
type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
@ -75,7 +74,7 @@ Material:
- _AlphaCutoff: 0.5 - _AlphaCutoff: 0.5
- _BumpAmt: 0 - _BumpAmt: 0
- _Dist: 1 - _Dist: 1
- _Distort: 0.01 - _Distort: 0
- _InvFade: 3 - _InvFade: 3
- _QueueControl: 0 - _QueueControl: 0
- _QueueOffset: 0 - _QueueOffset: 0

View File

@ -21,8 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Burnout_Sparks m_Name: Burnout_Sparks
m_Shader: {fileID: -6465566751694194690, guid: 894e255bca895714c929238ea0e6273f, m_Shader: {fileID: -6465566751694194690, guid: 894e255bca895714c929238ea0e6273f, type: 3}
type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
@ -76,6 +75,7 @@ Material:
- _AlphaToMask: 0 - _AlphaToMask: 0
- _Blend: 2 - _Blend: 2
- _BlendOp: 0 - _BlendOp: 0
- _Blur: -1
- _Boost: 65.64 - _Boost: 65.64
- _CameraFadingEnabled: 0 - _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2 - _CameraFarFadeDistance: 2
@ -109,6 +109,7 @@ Material:
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1} - _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -120,7 +120,7 @@ Material:
- _AlphaCutoff: 0.5 - _AlphaCutoff: 0.5
- _BurnOut: 0 - _BurnOut: 0
- _BurnUVOffset: 0.15 - _BurnUVOffset: 0.15
- _Burnout: 0.3 - _Burnout: 0
- _ClipThreshold: 0.12 - _ClipThreshold: 0.12
- _Cut: -0.47 - _Cut: -0.47
- _Cutoff: 0.33 - _Cutoff: 0.33

View File

@ -21,8 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: seeker_bolt_flare m_Name: seeker_bolt_flare
m_Shader: {fileID: -6465566751694194690, guid: 894e255bca895714c929238ea0e6273f, m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
@ -76,6 +75,7 @@ Material:
- _AlphaToMask: 0 - _AlphaToMask: 0
- _Blend: 2 - _Blend: 2
- _BlendOp: 0 - _BlendOp: 0
- _Blur: -1
- _Boost: 1.29 - _Boost: 1.29
- _CameraFadingEnabled: 0 - _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2 - _CameraFarFadeDistance: 2
@ -109,6 +109,7 @@ Material:
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 1, b: 0, a: 0} - _SoftParticleFadeParams: {r: 0, g: 1, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1} - _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -21,8 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: seeker_bolt_fragment m_Name: seeker_bolt_fragment
m_Shader: {fileID: -6465566751694194690, guid: 894e255bca895714c929238ea0e6273f, m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
@ -76,6 +75,7 @@ Material:
- _AlphaToMask: 0 - _AlphaToMask: 0
- _Blend: 2 - _Blend: 2
- _BlendOp: 0 - _BlendOp: 0
- _Blur: -1
- _Boost: 1 - _Boost: 1
- _CameraFadingEnabled: 0 - _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2 - _CameraFarFadeDistance: 2
@ -109,6 +109,7 @@ Material:
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 1, b: 0, a: 0} - _SoftParticleFadeParams: {r: 0, g: 1, b: 0, a: 0}
- _TintColor: {r: 0.99999994, g: 0.99999994, b: 0.99999994, a: 1} - _TintColor: {r: 0.99999994, g: 0.99999994, b: 0.99999994, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

View File

@ -8,8 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: seeker_bolt_muzzle m_Name: seeker_bolt_muzzle
m_Shader: {fileID: -6465566751694194690, guid: 894e255bca895714c929238ea0e6273f, m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
type: 3}
m_Parent: {fileID: 0} m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0 m_ModifiedSerializedProperties: 0
m_ValidKeywords: [] m_ValidKeywords: []
@ -63,6 +62,7 @@ Material:
- _AlphaToMask: 0 - _AlphaToMask: 0
- _Blend: 2 - _Blend: 2
- _BlendOp: 0 - _BlendOp: 0
- _Blur: -1
- _Boost: 1 - _Boost: 1
- _CameraFadingEnabled: 0 - _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2 - _CameraFarFadeDistance: 2

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 49ca46ce7082ccf4c91329cd9b7c4b61
NativeFormatImporter:
userData:

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 762a17aff08aa1f40ac72b27c15fe2d1
NativeFormatImporter:
userData:

View File

@ -1,319 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &100000
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400000}
- component: {fileID: 3300000}
- component: {fileID: 2300000}
m_Layer: 0
m_Name: Quad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400000
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0.7987106}
m_LocalScale: {x: 2.2, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 400004}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!33 &3300000
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2300000
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 931f12332f881b342980bc9900f15441, 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
--- !u!1 &100002
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400002}
- component: {fileID: 3300002}
- component: {fileID: 2300002}
m_Layer: 0
m_Name: Quad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400002
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100002}
m_LocalRotation: {x: 0.5, y: -0.5, z: 0.5, w: 0.5}
m_LocalPosition: {x: 0, y: 0, z: 0.7987106}
m_LocalScale: {x: 2.2, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 400004}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 90}
--- !u!33 &3300002
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100002}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2300002
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100002}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 931f12332f881b342980bc9900f15441, 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
--- !u!1 &100004
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400004}
- component: {fileID: 11400000}
- component: {fileID: 11400002}
m_Layer: 0
m_Name: seeker_bolt_muzzle_example
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400004
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
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: 400002}
- {fileID: 400000}
- {fileID: 400006}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: af19da7458dc9174699d0b34f404eafc, type: 3}
m_Name:
m_EditorClassIdentifier:
DespawnDelay: 0.05
DespawnOnMouseUp: 0
--- !u!114 &11400002
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a5df3c5f0444ba74991107c0d882530e, type: 3}
m_Name:
m_EditorClassIdentifier:
RandomScale: 1
RandomRotation: 1
MinScale: 0.8
MaxScale: 1.1
MinRotation: -360
MaxRotaion: 360
--- !u!1 &100006
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 400006}
- component: {fileID: 10800000}
m_Layer: 0
m_Name: Point light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &400006
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.6052952}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 400004}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &10800000
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100006}
m_Enabled: 1
serializedVersion: 10
m_Type: 2
m_Shape: 0
m_Color: {r: 1, g: 0.82941175, b: 0.5735294, a: 1}
m_Intensity: 1.2311152
m_Range: 250
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 1
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 0.536
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 1
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 43a8e47b31adb9a47b81c4653b412e5c
NativeFormatImporter:
userData: