summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XEditor/XSkillEditor/XBulletMgr.cs
blob: 3053179d65293b279db3773ff816238ea1ac8712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using XUtliPoolLib;

namespace XEditor
{
    internal class XBulletMgr : XSingleton<XBulletMgr>
    {
        private List<XBullet> _bullets = new List<XBullet>();

        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