/// <summary> /// Add a new AoiEntity /// </summary> /// <param name="key">key</param> /// <param name="x">X MinValue = -3.402823E+38f</param> /// <param name="y">Y MinValue = -3.402823E+38f</param> /// <returns></returns> public AoiEntity Enter(long key, float x, float y) { if (_entityList.TryGetValue(key, out var entity)) { return(entity); } entity = new AoiEntity(key); entity.X = _xLinks.Add(x, entity); entity.Y = _yLinks.Add(y, entity); _entityList.Add(key, entity); return(entity); }
/// <summary> /// Add a new AoiEntity /// </summary> /// <param name="key">key</param> /// <param name="x">X</param> /// <param name="y">Y</param> /// <returns></returns> public AoiEntity Enter(long key, float x, float y) { if (_entityList.TryGetValue(key, out var entity)) { return(entity); } entity = AoiPool.Instance.Fetch <AoiEntity>().Init(key); entity.X = _xLinks.Add(x, entity); entity.Y = _yLinks.Add(y, entity); _entityList.Add(key, entity); return(entity); }