From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XEditor/XSkillEditor/XBulletMgr.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs (limited to 'Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs') diff --git a/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs new file mode 100644 index 00000000..3053179d --- /dev/null +++ b/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs @@ -0,0 +1,34 @@ +#if UNITY_EDITOR +using System; +using System.Collections.Generic; +using XUtliPoolLib; + +namespace XEditor +{ + internal class XBulletMgr : XSingleton + { + private List _bullets = new List(); + + public void ShootBullet(XBullet bullet) + { + _bullets.Add(bullet); + } + + public void Update(float fDeltaT) + { + int len = _bullets.Count; + + for (int i = len - 1; i >= 0; i--) + { + if(_bullets[i].IsExpired()) + { + _bullets[i].Destroy(); + _bullets.RemoveAt(i); + } + else + _bullets[i].Update(fDeltaT); + } + } + } +} +#endif \ No newline at end of file -- cgit v1.1-26-g67d0