namespace Gameplay.Effect { using UnityEngine; public class BulletFlyLogic: BaseEffectLogic { private Vector3 _startPos; private Vector3 _endPos; private float _flyTime; public void Ctor(Vector3 startPos, Vector3 endPos, float flyTime) { _startPos = startPos; _endPos = endPos; _flyTime = flyTime; } protected override void _OnLogicUpdate(float dt) { base._OnLogicUpdate(dt); if (effect == null || effect.transform == null) return; var progress = Mathf.Clamp01(passTime / _flyTime); var pos = Vector3.Lerp(_startPos, _endPos, progress); effect.transform.position = pos; // DebugUtil.Log("BulletFlyLogic _OnLogicUpdate pos:" + pos + "passTime:" + passTime + "_flyTime:" + _flyTime // + "startPos:" + _startPos + "endPos:" + _endPos); if (passTime >= _flyTime) { effect.Destroy(); } } } }