77 lines
2.6 KiB
C#
77 lines
2.6 KiB
C#
using UnityEngine;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
/// <summary>
|
|
/// Instant-hit movement (no flight). Used for melee/instant skills.
|
|
/// Mirrors C++ CGfxOnTargetMove exactly (A3DSkillGfxEvent2.cpp:297-322).
|
|
/// 瞬间命中移动(无飞行)。用于近战/瞬发技能。
|
|
/// </summary>
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set position to target immediately. Cluster offset adds random radius.
|
|
/// 立即将位置设置到目标。群集偏移添加随机半径。
|
|
/// </summary>
|
|
public override void StartMove(Vector3 vHost, Vector3 vTarget)
|
|
{
|
|
BMLogger.LogError("CGfxOnTargetMove StartMove");
|
|
|
|
m_vPos = vTarget;
|
|
/*m_vMoveDir = vTarget - vHost;
|
|
m_vMoveDir.y = 0; // C++: zero out Y before normalize
|
|
if (Normalize(ref m_vMoveDir) == 0)
|
|
{
|
|
m_vMoveDir = Vector3.forward; // _unit_z
|
|
}
|
|
|
|
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;
|
|
}*/
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Always returns false — hit is triggered by fly time timeout, NOT by TickMove.
|
|
/// 始终返回false — 命中由飞行时间超时触发,而非TickMove。
|
|
/// </summary>
|
|
public override bool TickMove(uint dwDeltaTime, Vector3 vHostPos, Vector3 vTargetPos)
|
|
{
|
|
/* BMLogger.LogError("CGfxOnTargetMove Tick");
|
|
Vector3 oldPos = m_vPos;
|
|
m_vPos = vTargetPos + m_vOffset;*/
|
|
|
|
return false; // C++ returns false — hit triggered by fly time timeout
|
|
}
|
|
|
|
/// <summary>
|
|
/// Override to also read radius from param value.
|
|
/// 重写以从参数值中读取半径。
|
|
/// </summary>
|
|
public override void SetParam(GFX_SKILL_PARAM param)
|
|
{
|
|
base.SetParam(param);
|
|
m_fRadius = param.value.fVal; // C# union access: param.value.fVal
|
|
}
|
|
}
|
|
}
|