/// <summary> /// Refresh the 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> /// <param name="area">view</param> /// <returns></returns> public AoiEntity Refresh(long key, float x, float y, Vector2 area) { if (!_entityList.TryGetValue(key, out var entity)) { return(null); } var isFind = false; if (Math.Abs(entity.X.Value - x) > 0) { isFind = true; _xLinks.Move(entity.X, ref x); } if (Math.Abs(entity.Y.Value - y) > 0) { isFind = true; _yLinks.Move(entity.Y, ref y); } if (isFind) { Find(entity, ref area); } return(entity); }
/// <summary> /// Update the AoiEntity /// </summary> /// <param name="key">key</param> /// <param name="x">x</param> /// <param name="y">y</param> /// <param name="area">view</param> /// <returns></returns> public AoiEntity Update(long key, float x, float y, Vector2 area) { if (!_entityList.TryGetValue(key, out var entity)) { return(null); } if (Math.Abs(entity.X.Value - x) > 0) { _xLinks.Move(ref entity.X, ref x); } if (Math.Abs(entity.Y.Value - y) > 0) { _yLinks.Move(ref entity.Y, ref y); } Find(ref entity, ref area); return(entity); }