Compare commits
5 commits
c38d673768
...
826d7b5037
| Author | SHA1 | Date | |
|---|---|---|---|
| 826d7b5037 | |||
| c0e963fbeb | |||
| adfc6c106c | |||
| dd87fd6d0a | |||
| fb945db872 |
12 changed files with 3121 additions and 5 deletions
8
Assets/_Project/Art/VFX/spells.meta
Normal file
8
Assets/_Project/Art/VFX/spells.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 204a6f4885c16648c8bd80385fcbe93f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
133
Assets/_Project/Art/VFX/spells/Fireball.prefab
Normal file
133
Assets/_Project/Art/VFX/spells/Fireball.prefab
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &158073311046191680
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7644069561715729860}
|
||||
- component: {fileID: 4501491015215836543}
|
||||
- component: {fileID: 4205765680785243152}
|
||||
- component: {fileID: 8766422769305713616}
|
||||
m_Layer: 0
|
||||
m_Name: Fireball
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7644069561715729860
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158073311046191680}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -53.04094, y: 0, z: -31.13852}
|
||||
m_LocalScale: {x: 5, y: 5, z: 5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &4501491015215836543
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158073311046191680}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &4205765680785243152
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158073311046191680}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 94a6d1000bea4e36492489f6ab3d6349, 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_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!114 &8766422769305713616
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 158073311046191680}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 883bd1d14f70a623ea1b252cf7015a92, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::TD.VFX.FallFromSkyVisual
|
||||
dropHeight: 20
|
||||
duration: 0.5
|
||||
fallCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
fallAngleDegrees: 0
|
||||
fallDirection: {x: 0, y: 0, z: 1}
|
||||
7
Assets/_Project/Art/VFX/spells/Fireball.prefab.meta
Normal file
7
Assets/_Project/Art/VFX/spells/Fireball.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 80eaad6d0b024835482b64625b63053c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
137
Assets/_Project/Art/VFX/spells/FireballMaterial.mat
Normal file
137
Assets/_Project/Art/VFX/spells/FireballMaterial.mat
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-5733238300184794208
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: FireballMaterial
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AddPrecomputedVelocity: 0
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _DstBlendAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 0
|
||||
- _WorkflowMode: 1
|
||||
- _XRMotionVectorsPass: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.6196744, g: 0, b: 0, a: 1}
|
||||
- _Color: {r: 0.6196744, g: 0, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
8
Assets/_Project/Art/VFX/spells/FireballMaterial.mat.meta
Normal file
8
Assets/_Project/Art/VFX/spells/FireballMaterial.mat.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94a6d1000bea4e36492489f6ab3d6349
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2692
Assets/_Project/Art/VFX/spells/VFX_fireball_impact.vfx
Normal file
2692
Assets/_Project/Art/VFX/spells/VFX_fireball_impact.vfx
Normal file
File diff suppressed because it is too large
Load diff
15
Assets/_Project/Art/VFX/spells/VFX_fireball_impact.vfx.meta
Normal file
15
Assets/_Project/Art/VFX/spells/VFX_fireball_impact.vfx.meta
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3fa4641e771cdd27880ed1185a588a83
|
||||
VisualEffectImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
template:
|
||||
name:
|
||||
category:
|
||||
description:
|
||||
icon: {instanceID: 0}
|
||||
thumbnail: {instanceID: 0}
|
||||
useAsTemplate: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -12,13 +12,20 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 22b36bfcd0ae4af4098d908138e874e1, type: 3}
|
||||
m_Name: FireballSpell
|
||||
m_EditorClassIdentifier: Assembly-CSharp::TD.Gameplay.BuilderSpells.FireballSpellDefinition
|
||||
DisplayName:
|
||||
Description:
|
||||
DisplayName: Fireball
|
||||
Description: Shoot a fireball
|
||||
Icon: {fileID: 0}
|
||||
Cooldown: 5
|
||||
TargetType: 0
|
||||
Radius: 3
|
||||
enemyLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 128
|
||||
m_Bits: 1024
|
||||
impactVfxPrefab: {fileID: 158073311046191680, guid: 80eaad6d0b024835482b64625b63053c, type: 3}
|
||||
impactVfxLifetime: 2
|
||||
impactSound:
|
||||
clip: {fileID: 8300000, guid: 4ee1b63f27ea04451802bafd35ecef89, type: 3}
|
||||
volume: 0.5
|
||||
minPitch: 1.048
|
||||
maxPitch: 0.969
|
||||
Damage: 50
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ MonoBehaviour:
|
|||
Radius: 5
|
||||
enemyLayerMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 128
|
||||
m_Bits: 1024
|
||||
SlowFactor: 0.5
|
||||
EffectDuration: 3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// Assets/_Project/Scripts/Gameplay/BuilderSpells/FireballSpellDefinition.cs
|
||||
using UnityEngine;
|
||||
using TD.Audio;
|
||||
using TD.Core;
|
||||
|
||||
namespace TD.Gameplay.BuilderSpells
|
||||
|
|
@ -10,7 +11,7 @@ namespace TD.Gameplay.BuilderSpells
|
|||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="BuilderSpellDefinition.TargetType"/> is <see cref="SpellTargetType.PointTarget"/>
|
||||
/// — the cast controller shows only a fixed-size reticle, even though
|
||||
/// — the cast controller shows only a fixed-size reticule, even though
|
||||
/// <see cref="BuilderSpellDefinition.Radius"/> is still used internally here as the splash
|
||||
/// radius (0 = no splash, direct hit only).
|
||||
/// </remarks>
|
||||
|
|
@ -19,6 +20,20 @@ namespace TD.Gameplay.BuilderSpells
|
|||
{
|
||||
public override BuilderSpellKind Kind => BuilderSpellKind.Fireball;
|
||||
|
||||
[Header("Impact VFX")]
|
||||
[Tooltip("Prefab spawned at the target point on a successful cast. Optional — leave empty for no visual.")]
|
||||
[SerializeField] private GameObject impactVfxPrefab;
|
||||
|
||||
[Tooltip("Seconds before the spawned VFX instance is destroyed.")]
|
||||
[Min(0f)]
|
||||
[SerializeField] private float impactVfxLifetime = 2f;
|
||||
|
||||
[Header("Impact Sound")]
|
||||
[Tooltip("Sound played on every peer when this spell resolves successfully. Same " +
|
||||
"SoundConfig struct TowerBuiltSound uses — reuse a tower's clip directly if " +
|
||||
"you want the same sound.")]
|
||||
[SerializeField] private SoundConfig impactSound;
|
||||
|
||||
[Header("Fireball")]
|
||||
[Tooltip("Damage dealt to every enemy within Radius of the target point.")]
|
||||
[Min(0f)]
|
||||
|
|
@ -43,5 +58,15 @@ namespace TD.Gameplay.BuilderSpells
|
|||
|
||||
return hitAny;
|
||||
}
|
||||
|
||||
public override void ClientPlayVfx(Vector3 targetPoint)
|
||||
{
|
||||
if (impactVfxPrefab != null)
|
||||
Destroy(Instantiate(impactVfxPrefab, targetPoint, Quaternion.identity), impactVfxLifetime);
|
||||
|
||||
if (impactSound.clip != null)
|
||||
AudioManager.Instance?.Play(impactSound.clip, AudioCategory.TowerFire,
|
||||
impactSound.RandomPitch(), impactSound.volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
82
Assets/_Project/Scripts/VFX/FallFromSkyVisual.cs
Normal file
82
Assets/_Project/Scripts/VFX/FallFromSkyVisual.cs
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
// Assets/_Project/Scripts/VFX/FallFromSkyVisual.cs
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace TD.VFX
|
||||
{
|
||||
/// <summary>
|
||||
/// Animates this object falling from the sky down to its own spawn position. Intended for
|
||||
/// a one-shot placeholder VFX prefab (e.g. <c>FireballSpellDefinition.impactVfxPrefab</c>)
|
||||
/// that gets instantiated already at the correct landing point — on <c>Start</c>, it snaps
|
||||
/// itself up by <see cref="dropHeight"/> and animates back down over
|
||||
/// <see cref="duration"/> seconds.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Mirrors <see cref="TD.Combat.TowerLandingVisual"/>'s fall coroutine, minus the
|
||||
/// <c>TowerInstance</c> coupling — this is a plain local one-shot visual, not tied to any
|
||||
/// networked gameplay state, so it can run from <c>Start()</c> instead of waiting on a
|
||||
/// spawn event.
|
||||
/// </remarks>
|
||||
public class FallFromSkyVisual : MonoBehaviour
|
||||
{
|
||||
[Tooltip("How high above the landing point this object starts.")]
|
||||
[SerializeField] private float dropHeight = 20f;
|
||||
|
||||
[Tooltip("Seconds for the fall animation to complete.")]
|
||||
[Min(0.01f)]
|
||||
[SerializeField] private float duration = 0.5f;
|
||||
|
||||
[Tooltip("Eases the fall over Duration. X = normalized time, Y = normalized fraction " +
|
||||
"of DropHeight already descended (0 = still at drop height, 1 = landed).")]
|
||||
[SerializeField] private AnimationCurve fallCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
|
||||
|
||||
[Header("Angle (optional — 0 = straight down)")]
|
||||
[Tooltip("Angle from vertical, in degrees. 0 = falls straight down. Higher values = " +
|
||||
"a shallower, more meteor-like diagonal approach. Capped below 90 — at 90 the " +
|
||||
"object would never actually descend.")]
|
||||
[Range(0f, 80f)]
|
||||
[SerializeField] private float fallAngleDegrees = 0f;
|
||||
|
||||
[Tooltip("Horizontal direction the object travels as it falls (only used when " +
|
||||
"FallAngleDegrees > 0). Magnitude is ignored — normalized automatically.")]
|
||||
[SerializeField] private Vector3 fallDirection = Vector3.forward;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartCoroutine(AnimateDrop());
|
||||
}
|
||||
|
||||
private IEnumerator AnimateDrop()
|
||||
{
|
||||
Vector3 landedPosition = transform.position; // already correct — spawned at the target point
|
||||
|
||||
// Split dropHeight into a vertical component (unchanged from the straight-down case)
|
||||
// plus a horizontal component derived from the angle via basic trig: at angle θ from
|
||||
// vertical, horizontal distance = dropHeight * tan(θ). At θ = 0 this is 0, so the
|
||||
// whole angle path collapses back to the original straight-down offset.
|
||||
float angleRad = fallAngleDegrees * Mathf.Deg2Rad;
|
||||
float horizontalDistance = dropHeight * Mathf.Tan(angleRad);
|
||||
|
||||
// Only the horizontal (XZ) part of fallDirection matters — a Y component would just
|
||||
// be double-counting dropHeight, so it's dropped before normalizing.
|
||||
Vector3 flatDirection = new Vector3(fallDirection.x, 0f, fallDirection.z);
|
||||
Vector3 horizontalDir = flatDirection.sqrMagnitude > 0.0001f
|
||||
? flatDirection.normalized
|
||||
: Vector3.zero;
|
||||
|
||||
Vector3 startOffset = Vector3.up * dropHeight - horizontalDir * horizontalDistance;
|
||||
transform.position = landedPosition + startOffset;
|
||||
|
||||
float t = 0f;
|
||||
while (t < duration)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
float u = fallCurve.Evaluate(Mathf.Clamp01(t / duration));
|
||||
transform.position = landedPosition + startOffset * (1f - u);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
transform.position = landedPosition; // snap exactly, avoid float drift
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/_Project/Scripts/VFX/FallFromSkyVisual.cs.meta
Normal file
2
Assets/_Project/Scripts/VFX/FallFromSkyVisual.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 883bd1d14f70a623ea1b252cf7015a92
|
||||
Loading…
Add table
Add a link
Reference in a new issue