shitty looking AOE effect for slow area

This commit is contained in:
Ian Woods 2026-07-17 00:03:36 -07:00
parent fe2c59d326
commit 689fe7be88
8 changed files with 2778 additions and 5 deletions

View file

@ -104,7 +104,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::TD.VFX.FallFromSkyVisual
dropHeight: 20
duration: 0.5
duration: 1.2
fallCurve:
serializedVersion: 2
m_Curve:
@ -129,5 +129,5 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
fallAngleDegrees: 0
fallDirection: {x: 0, y: 0, z: 1}
fallAngleDegrees: 25.6
fallDirection: {x: 0.2, y: 0.2, z: 1}

View file

@ -0,0 +1,120 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1462673130280185047
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 30710218362299472}
- component: {fileID: 2262385832724230530}
- component: {fileID: 5239089805406934537}
m_Layer: 0
m_Name: VFX_slowarea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &30710218362299472
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1462673130280185047}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -55.61683, y: -0, z: -33.87226}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!2083052967 &2262385832724230530
VisualEffect:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1462673130280185047}
m_Enabled: 1
m_Asset: {fileID: 8926484042661614526, guid: 397a5bed36b1e63a0a3eef17b04f65bd, type: 3}
m_InitialEventName: OnPlay
m_InitialEventNameOverriden: 0
m_StartSeed: 0
m_ResetSeedOnPlay: 1
m_AllowInstancing: 1
m_ResourceVersion: 1
m_PropertySheet:
m_Float:
m_Array: []
m_Vector2f:
m_Array: []
m_Vector3f:
m_Array: []
m_Vector4f:
m_Array: []
m_Uint:
m_Array: []
m_Int:
m_Array: []
m_Matrix4x4f:
m_Array: []
m_AnimationCurve:
m_Array: []
m_Gradient:
m_Array: []
m_NamedObject:
m_Array: []
m_Bool:
m_Array: []
--- !u!73398921 &5239089805406934537
VFXRenderer:
serializedVersion: 1
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1462673130280185047}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_ForceMeshLod: -1
m_MeshLodSelectionBias: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
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_GlobalIlluminationMeshLod: 0
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bf2f1f2a9a54e9162b80673e3f7eeaf6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
fileFormatVersion: 2
guid: 397a5bed36b1e63a0a3eef17b04f65bd
VisualEffectImporter:
externalObjects: {}
serializedVersion: 2
template:
name:
category:
description:
icon: {instanceID: 0}
thumbnail: {instanceID: 0}
useAsTemplate: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -22,7 +22,7 @@ MonoBehaviour:
serializedVersion: 2
m_Bits: 1024
impactVfxPrefab: {fileID: 158073311046191680, guid: 80eaad6d0b024835482b64625b63053c, type: 3}
impactVfxLifetime: 2
impactVfxLifetime: 3
impactSound:
clip: {fileID: 8300000, guid: 4ee1b63f27ea04451802bafd35ecef89, type: 3}
volume: 0.5

View file

@ -16,10 +16,16 @@ MonoBehaviour:
Description: Slows enemies in an area
Icon: {fileID: 0}
Cooldown: 5
TargetType: 0
TargetType: 1
Radius: 5
enemyLayerMask:
serializedVersion: 2
m_Bits: 1024
areaVfxPrefab: {fileID: 1462673130280185047, guid: bf2f1f2a9a54e9162b80673e3f7eeaf6, type: 3}
areaSound:
clip: {fileID: 0}
volume: 0
minPitch: 0
maxPitch: 0
SlowFactor: 0.5
EffectDuration: 3

View file

@ -1,5 +1,6 @@
// Assets/_Project/Scripts/Gameplay/BuilderSpells/SlowAreaSpellDefinition.cs
using UnityEngine;
using TD.Audio;
using TD.Core;
namespace TD.Gameplay.BuilderSpells
@ -19,6 +20,15 @@ namespace TD.Gameplay.BuilderSpells
{
public override BuilderSpellKind Kind => BuilderSpellKind.SlowArea;
[Header("Area VFX")]
[Tooltip("Prefab spawned at the target point on a successful cast, authored at a 1-unit " +
"radius — scaled up to match Radius here. Lives for EffectDuration, matching " +
"how long the slow itself lasts. Optional — leave empty for no visual.")]
[SerializeField] private GameObject areaVfxPrefab;
[Tooltip("Sound played on every peer when this spell resolves successfully.")]
[SerializeField] private SoundConfig areaSound;
[Header("Slow Area")]
[Tooltip("Speed multiplier applied to affected enemies for EffectDuration " +
"(e.g. 0.5 = half speed).")]
@ -51,5 +61,19 @@ namespace TD.Gameplay.BuilderSpells
return hitAny;
}
public override void ClientPlayVfx(Vector3 targetPoint)
{
if (areaVfxPrefab != null)
{
var instance = Instantiate(areaVfxPrefab, targetPoint, Quaternion.identity);
instance.transform.localScale *= Mathf.Max(Radius, 0.01f);
Destroy(instance, EffectDuration);
}
if (areaSound.clip != null)
AudioManager.Instance?.Play(areaSound.clip, AudioCategory.Combat,
areaSound.RandomPitch(), areaSound.volume);
}
}
}