using System.Collections.Generic; using Entitas; using UnityEngine; namespace CoreGame.Render { public class SurroundBulletSys : IExecuteSystem { private readonly CombatContext m_Context; private readonly IGroup m_SurroundBulletGroup; private readonly List m_CacheEntities = new List(); public SurroundBulletSys(CombatContext context) { m_Context = context; m_SurroundBulletGroup = context.GetGroup(CombatMatcher.SurroundBullet); } public void Execute(float deltaTime) { // m_SurroundBulletGroup.GetEntities(m_CacheEntities); // for (var i = 0; i < m_CacheEntities.Count; i++) // { // var bulletEnt = m_CacheEntities[i]; // if (bulletEnt.bullet.hasInvalidated) // continue; // var trans = bulletEnt.transformProxy; // var surroundBullet = bulletEnt.surroundBullet; // var handleEnt = ((CombatEntity)m_Context.GetEntity(surroundBullet.handleEid)); // if (handleEnt.IsValid() == false) // { // var bc = bulletEnt.bullet; // if (bc.isTriggerHitSkillOnEnd || bc.endAbilityId != 0) // { // BulletSrv.InvalidateBullet(bulletEnt); // if (bc.isTriggerHitSkillOnEnd) // { // BulletSrv.BulletSkillCast(bulletEnt, 0, trans.position, bc.abilityId); // } // // if (bc.endAbilityId != 0) // { // BulletSrv.BulletSkillCast(bulletEnt, 0, trans.position, bc.endAbilityId); // } // } // else // { // BulletSrv.DestroyBullet(bulletEnt); // } // continue; // } // var handleTransPos = handleEnt.transformProxy.position; // var dir = Vector2.right; // var angleRadians = Mathf.Deg2Rad * surroundBullet.angle; // var x = dir.x * Mathf.Cos(angleRadians) - dir.y * Mathf.Sin(angleRadians); // var y = dir.x * Mathf.Sin(angleRadians) + dir.y * Mathf.Cos(angleRadians); // dir.x = x; // dir.y = y; // // var targetPos = handleTransPos + dir * surroundBullet.distance; // // surroundBullet.angle += -bulletEnt.bullet.speed * deltaTime; // switch (surroundBullet.angle) // { // case > 360f: // surroundBullet.angle -= 360f; // break; // case < -360f: // surroundBullet.angle += 360f; // break; // } // // trans.SetDirection(targetPos - trans.position); // trans.SetPosition(targetPos); // } } } }