public void Execute([ReadOnly] ref SphereCollider checkHitCollider, ref Destroyable destroyable) { int hash = GridHash.Hash(checkHitCollider.Position, this.CellRadius); int index; NativeMultiHashMapIterator <int> iterator; for (bool success = this.PlayerHashmap.TryGetFirstValue(hash, out index, out iterator); success; success = this.PlayerHashmap.TryGetNextValue(out index, ref iterator)) { var playerCollider = this.PlayerColliders[index]; if (checkHitCollider.Intersect(ref playerCollider)) { // ヒット destroyable = Destroyable.Kill; } } }
public void Execute(int i) { var sphereCollider = this.SphereColliders[i]; var center = sphereCollider.Position; var hashCenter = GridHash.Hash(center, this.CellRadius); this.Hashmap.Add(hashCenter, i); for (int j = 0; j < this.Offsets.Length; ++j) { var offset = center + this.Offsets[j] * sphereCollider.Radius; var hash = GridHash.Hash(offset, this.CellRadius); if (hash == hashCenter) { continue; } this.Hashmap.Add(hash, i); } }