// using System; // // using GAS.Runtime; // using Sirenix.OdinInspector; // using Sog; // // namespace CoreGame.Logic // { // [Serializable] // public class TaskCastFlyBullet : OngoingAbilityTask // { // public int bulletId; // public bool randomElementType; // public string canCastExpr = ""; // // [ShowInInspector] // [HideReferenceObjectPicker] // [ShowIf("m_Cfg")] // private BulletDesc m_Cfg => BulletDescMgr.Instance.GetConfig(bulletId); // // private int m_CastCount; // private Fixed64 m_CastInterval; // private Fixed64 m_AccumulateTime; // private Fixed64 m_AccRotateAngle; // private bool m_CanCast; // // public override void OnStart(Fixed64 startTime, GameAbilityContext ctx) // { // m_CanCast = BulletSrv.CanCast(ctx, canCastExpr); // if (!m_CanCast) // return; // // m_CastCount = (int)ExpressionEvaluator.CalcVal_WithCtx(m_Cfg.fireTimes, ctx, 3f); // m_CastInterval = m_Cfg.fireDelay * BattleConst.TenThousandReverse; // var fireDelayMax = m_Cfg.fireDelayMax * BattleConst.TenThousandReverse; // if ((m_CastCount - 1) * m_CastInterval > fireDelayMax) // { // m_CastInterval = fireDelayMax / (m_CastCount - 1); // } // // m_AccumulateTime = 0f; // m_AccRotateAngle = 0f; // if (m_CastCount > 0) // { // BulletSrv.CreateBulletWithPoint(ctx, bulletId, 0, randomElementType); // m_CastCount--; // m_AccRotateAngle += m_Cfg.rotateEachTime * BattleConst.TenThousandReverse; // } // } // // public override void OnEnd(Fixed64 endTime, GameAbilityContext ctx) // { // } // // public override void OnTick(Fixed64 dt, Fixed64 startTime, Fixed64 endTime, GameAbilityContext ctx) // { // if (!m_CanCast) // return; // // if (m_AccumulateTime >= m_CastInterval && m_CastCount > 0) // { // BulletSrv.CreateBulletWithPoint(ctx, bulletId, m_AccRotateAngle, randomElementType); // m_AccumulateTime -= m_CastInterval; // m_CastCount--; // m_AccRotateAngle += m_Cfg.rotateEachTime * Fixed64.EN4; // } // m_AccumulateTime += dt; // } // } // }