using System;
using Il2CppInterop.Common.Attributes;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using UnityEngine;

// Token: 0x02000256 RID: 598
public class SpatialHashManager : MonoBehaviour
{
	// Token: 0x060054FE RID: 21758 RVA: 0x00152BB0 File Offset: 0x00150DB0
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 579017, RefRangeEnd = 579018, XrefRangeStart = 578992, XrefRangeEnd = 579017, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe void Init(int stageId)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		checked
		{
			IntPtr* ptr = stackalloc IntPtr[unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref stageId;
			IntPtr intPtr2;
			IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_Init_Public_Void_Int32_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
			Il2CppException.RaiseExceptionIfNecessary(intPtr2);
		}
	}

	// Token: 0x060054FF RID: 21759 RVA: 0x00152C04 File Offset: 0x00150E04
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 579025, RefRangeEnd = 579026, XrefRangeStart = 579018, XrefRangeEnd = 579025, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe void Add(int id, Vector3 unitPos)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		IntPtr* ptr;
		checked
		{
			ptr = stackalloc IntPtr[unchecked((UIntPtr)2) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref id;
		}
		ptr[checked(unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)) / (UIntPtr)sizeof(IntPtr)] = ref unitPos;
		IntPtr intPtr2;
		IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_Add_Public_Void_Int32_Vector3_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
		Il2CppException.RaiseExceptionIfNecessary(intPtr2);
	}

	// Token: 0x06005500 RID: 21760 RVA: 0x00152C6C File Offset: 0x00150E6C
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 579033, RefRangeEnd = 579034, XrefRangeStart = 579026, XrefRangeEnd = 579033, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe void Remove(int id, Vector3 unitPos)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		IntPtr* ptr;
		checked
		{
			ptr = stackalloc IntPtr[unchecked((UIntPtr)2) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref id;
		}
		ptr[checked(unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)) / (UIntPtr)sizeof(IntPtr)] = ref unitPos;
		IntPtr intPtr2;
		IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_Remove_Public_Void_Int32_Vector3_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
		Il2CppException.RaiseExceptionIfNecessary(intPtr2);
	}

	// Token: 0x06005501 RID: 21761 RVA: 0x00152CD4 File Offset: 0x00150ED4
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 579035, RefRangeEnd = 579036, XrefRangeStart = 579034, XrefRangeEnd = 579035, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe Dictionary<int, Vector3> FindNearUnits(Vector3 unitPos)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		checked
		{
			IntPtr* ptr = stackalloc IntPtr[unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref unitPos;
			IntPtr intPtr2;
			IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_FindNearUnits_Public_Dictionary_2_Int32_Vector3_Vector3_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
			Il2CppException.RaiseExceptionIfNecessary(intPtr2);
			IntPtr intPtr3 = intPtr;
			return (intPtr3 != 0) ? new Dictionary<int, Vector3>(intPtr3) : null;
		}
	}

	// Token: 0x06005502 RID: 21762 RVA: 0x00152D3C File Offset: 0x00150F3C
	[CallerCount(0)]
	[CachedScanResults(RefRangeStart = 0, RefRangeEnd = 0, XrefRangeStart = 579036, XrefRangeEnd = 579038, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe Vector2Int ConvertFromWorldToCell(Vector3 pos)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		checked
		{
			IntPtr* ptr = stackalloc IntPtr[unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref pos;
			IntPtr intPtr2;
			IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_ConvertFromWorldToCell_Private_Vector2Int_Vector3_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
			Il2CppException.RaiseExceptionIfNecessary(intPtr2);
			return *IL2CPP.il2cpp_object_unbox(intPtr);
		}
	}

	// Token: 0x06005503 RID: 21763 RVA: 0x00152DA0 File Offset: 0x00150FA0
	[CallerCount(0)]
	[CachedScanResults(RefRangeStart = 0, RefRangeEnd = 0, XrefRangeStart = 579038, XrefRangeEnd = 579049, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe SpatialHashGridData GetSpatialHashGridData(int stageId)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		checked
		{
			IntPtr* ptr = stackalloc IntPtr[unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref stageId;
			IntPtr intPtr2;
			IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_GetSpatialHashGridData_Private_SpatialHashGridData_Int32_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
			Il2CppException.RaiseExceptionIfNecessary(intPtr2);
			IntPtr intPtr3 = intPtr;
			return (intPtr3 != 0) ? new SpatialHashGridData(intPtr3) : null;
		}
	}

	// Token: 0x06005504 RID: 21764 RVA: 0x00152E08 File Offset: 0x00151008
	[CallerCount(3)]
	[CachedScanResults(RefRangeStart = 579051, RefRangeEnd = 579054, XrefRangeStart = 579049, XrefRangeEnd = 579051, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe bool TryGetValidCellPos(Vector3 pos, out Vector2Int cellPos)
	{
		IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
		IntPtr* ptr;
		checked
		{
			ptr = stackalloc IntPtr[unchecked((UIntPtr)2) * (UIntPtr)sizeof(IntPtr)];
			*ptr = ref pos;
		}
		ptr[checked(unchecked((UIntPtr)1) * (UIntPtr)sizeof(IntPtr)) / (UIntPtr)sizeof(IntPtr)] = &cellPos;
		IntPtr intPtr2;
		IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr_TryGetValidCellPos_Private_Boolean_Vector3_byref_Vector2Int_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
		Il2CppException.RaiseExceptionIfNecessary(intPtr2);
		return *IL2CPP.il2cpp_object_unbox(intPtr);
	}

	// Token: 0x06005505 RID: 21765 RVA: 0x00152E80 File Offset: 0x00151080
	[CallerCount(0)]
	[CachedScanResults(RefRangeStart = 0, RefRangeEnd = 0, XrefRangeStart = 579054, XrefRangeEnd = 579060, MetadataInitTokenRva = 0L, MetadataInitFlagRva = 0L)]
	public unsafe SpatialHashManager()
		: this(IL2CPP.il2cpp_object_new(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr))
	{
		IntPtr* ptr = null;
		IntPtr intPtr2;
		IntPtr intPtr = IL2CPP.il2cpp_runtime_invoke(SpatialHashManager.NativeMethodInfoPtr__ctor_Public_Void_0, IL2CPP.Il2CppObjectBaseToPtrNotNull(this), (void**)ptr, ref intPtr2);
		Il2CppException.RaiseExceptionIfNecessary(intPtr2);
	}

	// Token: 0x06005506 RID: 21766 RVA: 0x00152ECC File Offset: 0x001510CC
	// Note: this type is marked as 'beforefieldinit'.
	static SpatialHashManager()
	{
		Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr = IL2CPP.GetIl2CppClass("Assembly-CSharp.dll", "", "SpatialHashManager");
		IL2CPP.il2cpp_runtime_class_init(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr);
		SpatialHashManager.NativeFieldInfoPtr_spatialHashSettings = IL2CPP.GetIl2CppField(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, "spatialHashSettings");
		SpatialHashManager.NativeFieldInfoPtr_spatialHashGridData = IL2CPP.GetIl2CppField(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, "spatialHashGridData");
		SpatialHashManager.NativeFieldInfoPtr_cells = IL2CPP.GetIl2CppField(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, "cells");
		SpatialHashManager.NativeMethodInfoPtr_Init_Public_Void_Int32_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669019);
		SpatialHashManager.NativeMethodInfoPtr_Add_Public_Void_Int32_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669020);
		SpatialHashManager.NativeMethodInfoPtr_Remove_Public_Void_Int32_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669021);
		SpatialHashManager.NativeMethodInfoPtr_FindNearUnits_Public_Dictionary_2_Int32_Vector3_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669022);
		SpatialHashManager.NativeMethodInfoPtr_ConvertFromWorldToCell_Private_Vector2Int_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669023);
		SpatialHashManager.NativeMethodInfoPtr_GetSpatialHashGridData_Private_SpatialHashGridData_Int32_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669024);
		SpatialHashManager.NativeMethodInfoPtr_TryGetValidCellPos_Private_Boolean_Vector3_byref_Vector2Int_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669025);
		SpatialHashManager.NativeMethodInfoPtr__ctor_Public_Void_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100669026);
	}

	// Token: 0x06005507 RID: 21767 RVA: 0x0000351C File Offset: 0x0000171C
	public SpatialHashManager(IntPtr pointer)
		: base(pointer)
	{
	}

	// Token: 0x17001E2F RID: 7727
	// (get) Token: 0x06005508 RID: 21768 RVA: 0x00152FD8 File Offset: 0x001511D8
	// (set) Token: 0x06005509 RID: 21769 RVA: 0x0015300C File Offset: 0x0015120C
	public unsafe GameSpatialHashSettings spatialHashSettings
	{
		get
		{
			IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtrNotNull(this) + (IntPtr)IL2CPP.il2cpp_field_get_offset(SpatialHashManager.NativeFieldInfoPtr_spatialHashSettings);
			IntPtr intPtr2 = *intPtr;
			return (intPtr2 != 0) ? new GameSpatialHashSettings(intPtr2) : null;
		}
		set
		{
			IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
			IL2CPP.il2cpp_gc_wbarrier_set_field(intPtr, intPtr + (IntPtr)IL2CPP.il2cpp_field_get_offset(SpatialHashManager.NativeFieldInfoPtr_spatialHashSettings), IL2CPP.Il2CppObjectBaseToPtr(value));
		}
	}

	// Token: 0x17001E30 RID: 7728
	// (get) Token: 0x0600550A RID: 21770 RVA: 0x00153034 File Offset: 0x00151234
	// (set) Token: 0x0600550B RID: 21771 RVA: 0x00153068 File Offset: 0x00151268
	public unsafe SpatialHashGridData spatialHashGridData
	{
		get
		{
			IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtrNotNull(this) + (IntPtr)IL2CPP.il2cpp_field_get_offset(SpatialHashManager.NativeFieldInfoPtr_spatialHashGridData);
			IntPtr intPtr2 = *intPtr;
			return (intPtr2 != 0) ? new SpatialHashGridData(intPtr2) : null;
		}
		set
		{
			IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
			IL2CPP.il2cpp_gc_wbarrier_set_field(intPtr, intPtr + (IntPtr)IL2CPP.il2cpp_field_get_offset(SpatialHashManager.NativeFieldInfoPtr_spatialHashGridData), IL2CPP.Il2CppObjectBaseToPtr(value));
		}
	}

	// Token: 0x17001E31 RID: 7729
	// (get) Token: 0x0600550C RID: 21772 RVA: 0x00153090 File Offset: 0x00151290
	// (set) Token: 0x0600550D RID: 21773 RVA: 0x001530C4 File Offset: 0x001512C4
	public unsafe Il2CppObjectBase cells
	{
		get
		{
			IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtrNotNull(this) + (IntPtr)IL2CPP.il2cpp_field_get_offset(SpatialHashManager.NativeFieldInfoPtr_cells);
			IntPtr intPtr2 = *intPtr;
			return (intPtr2 != 0) ? new Il2CppObjectBase(intPtr2) : null;
		}
		set
		{
			IntPtr intPtr = IL2CPP.Il2CppObjectBaseToPtrNotNull(this);
			IL2CPP.il2cpp_gc_wbarrier_set_field(intPtr, intPtr + (IntPtr)IL2CPP.il2cpp_field_get_offset(SpatialHashManager.NativeFieldInfoPtr_cells), IL2CPP.Il2CppObjectBaseToPtr(value));
		}
	}

	// Token: 0x040037FC RID: 14332
	private static readonly IntPtr NativeFieldInfoPtr_spatialHashSettings;

	// Token: 0x040037FD RID: 14333
	private static readonly IntPtr NativeFieldInfoPtr_spatialHashGridData;

	// Token: 0x040037FE RID: 14334
	private static readonly IntPtr NativeFieldInfoPtr_cells;

	// Token: 0x040037FF RID: 14335
	private static readonly IntPtr NativeMethodInfoPtr_Init_Public_Void_Int32_0;

	// Token: 0x04003800 RID: 14336
	private static readonly IntPtr NativeMethodInfoPtr_Add_Public_Void_Int32_Vector3_0;

	// Token: 0x04003801 RID: 14337
	private static readonly IntPtr NativeMethodInfoPtr_Remove_Public_Void_Int32_Vector3_0;

	// Token: 0x04003802 RID: 14338
	private static readonly IntPtr NativeMethodInfoPtr_FindNearUnits_Public_Dictionary_2_Int32_Vector3_Vector3_0;

	// Token: 0x04003803 RID: 14339
	private static readonly IntPtr NativeMethodInfoPtr_ConvertFromWorldToCell_Private_Vector2Int_Vector3_0;

	// Token: 0x04003804 RID: 14340
	private static readonly IntPtr NativeMethodInfoPtr_GetSpatialHashGridData_Private_SpatialHashGridData_Int32_0;

	// Token: 0x04003805 RID: 14341
	private static readonly IntPtr NativeMethodInfoPtr_TryGetValidCellPos_Private_Boolean_Vector3_byref_Vector2Int_0;

	// Token: 0x04003806 RID: 14342
	private static readonly IntPtr NativeMethodInfoPtr__ctor_Public_Void_0;
}
