yyl
2025-08-25 cec8b67d82c2c2c1662d55c818c4a46bcc0487db
Main/System/Battle/SkillEffect/BulletCurve/StraightBulletCurve.cs
@@ -8,25 +8,37 @@
    private Vector2 end;
    public StraightBulletCurve(BattleObject caster, SkillConfig skillConfig, BattleEffectPlayer bulletEffect, RectTransform target, HB427_tagSCUseSkill tagUseSkillAttack, Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> onHit)
        : base(caster, skillConfig, bulletEffect, target, tagUseSkillAttack, onHit) { }
        : base(caster, skillConfig, bulletEffect, target, tagUseSkillAttack, onHit)
    {
        BattleDebug.LogError("StraightBulletCurve created bulletTrans is null = " + (bulletTrans == null).ToString());
    }
    public override void Reset()
    {
        base.Reset();
        start = WorldToLocalAnchoredPosition(bulletTrans.position);
        end = WorldToLocalAnchoredPosition(target.position);
        // BattleUtility.MarkStartAndEnd(bulletTrans, target);
    }
    public override void Run()
    {
        if (finished) return;
        if (bulletTrans == null)
        {
            BattleDebug.LogError("BulletTrans is null, cannot run StraightBulletCurve");
            return;
        }
        elapsed += Time.deltaTime;
        float t = Mathf.Clamp01(elapsed / duration);
        float t = Mathf.Clamp01(elapsed / 0.3f);
        Vector2 pos = Vector2.Lerp(start, end, t);
        bulletTrans.anchoredPosition = pos;
        Vector2 dir = end - start;
        float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg - 90f;
        float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
        bulletTrans.localRotation = Quaternion.Euler(0, 0, angle);
        if (t >= 1f)