public void Init(int sn, Vector3 startPos, Skill skill) { _pos = startPos; _skill = skill; _bulletParser = Data.Inst.Fight_Bullet(sn); if (_bulletParser.life < 0) { Debug.LogError("<Bullet> 子弹的生命周期不能小于0,请检查!Sn = " + sn); PoolMgr.Inst.DespawnObj(this); return; } TimerMgr.Inst.RegisterFrameTimer(Update, -1, true, true, _bulletParser.life, LifeEnd); }
private void ParseFight_Bullet() { _fight_BulletDic = new Dictionary <int, Fight_BulletParser>(); TableHandler handler = TableHandler.OpenFromResmap("Fight_Bullet"); for (int i = 0; i < handler.GetRecordsNum() - 1; i++) { int key = int.Parse(handler.GetValue(i, 0)); Fight_BulletParser info = new Fight_BulletParser() { sn = int.Parse(handler.GetValue(i, 0)), life = float.Parse(handler.GetValue(i, 1)), speed = float.Parse(handler.GetValue(i, 2)), checkType = int.Parse(handler.GetValue(i, 3)), checkValues = ToFloatArray(handler.GetValue(i, 4)), trigger = int.Parse(handler.GetValue(i, 5)), targetType = int.Parse(handler.GetValue(i, 6)), targetValues = ToFloatArray(handler.GetValue(i, 7)), effectList = ToIntArray(handler.GetValue(i, 8)), }; } }
//对象被回收时调用 public void Release() { _bulletParser = null; _skill = null; _isDie = false; }