using UnityEngine; namespace BrewMonster { /// /// Instant-hit movement (no flight). Used for melee/instant skills. /// Mirrors C++ CGfxOnTargetMove exactly (A3DSkillGfxEvent2.cpp:297-322). /// 瞬间命中移动(无飞行)。用于近战/瞬发技能。 /// public class CGfxOnTargetMove : CGfxMoveBase { protected float m_fRadius; protected Vector3 m_vOffset; public CGfxOnTargetMove(GfxMoveMode mode) : base(mode) { m_HitPos = GfxHitPos.enumHitBottom; m_fRadius = 0; } /// /// Set position to target immediately. Cluster offset adds random radius. /// 立即将位置设置到目标。群集偏移添加随机半径。 /// public override void StartMove(Vector3 vHost, Vector3 vTarget) { m_vPos = vTarget; m_vMoveDir = vTarget - vHost; m_vMoveDir.y = 0; if (Normalize(ref m_vMoveDir) == 0) { m_vMoveDir = Vector3.forward; } if (m_bOneOfCluser) { float fRandAng = Random.value * Mathf.PI * 2f; float fRadius = Random.value * m_fRadius; m_vOffset.x = Mathf.Cos(fRandAng) * fRadius; m_vOffset.z = Mathf.Sin(fRandAng) * fRadius; m_vOffset.y = 0; m_vPos += m_vOffset; } else { m_vOffset = Vector3.zero; } } /// /// Always returns false — hit is triggered by fly time timeout, NOT by TickMove. /// 始终返回false — 命中由飞行时间超时触发,而非TickMove。 /// public override bool TickMove(uint dwDeltaTime, Vector3 vHostPos, Vector3 vTargetPos) { m_vPos = vTargetPos + m_vOffset; return false; // C++ returns false — hit triggered by fly time timeout } /// /// Override to also read radius from param value. /// 重写以从参数值中读取半径。 /// public override void SetParam(GFX_SKILL_PARAM param) { base.SetParam(param); m_fRadius = param.value.fVal; // C# union access: param.value.fVal } } }