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

// Token: 0x02000215 RID: 533
public class SpatialHashManager : MonoBehaviour
{
	// Token: 0x06004F8D RID: 20365 RVA: 0x0013C1F8 File Offset: 0x0013A3F8
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 550800, RefRangeEnd = 550801, XrefRangeStart = 550775, XrefRangeEnd = 550800, 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: 0x06004F8E RID: 20366 RVA: 0x0013C24C File Offset: 0x0013A44C
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 550808, RefRangeEnd = 550809, XrefRangeStart = 550801, XrefRangeEnd = 550808, 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: 0x06004F8F RID: 20367 RVA: 0x0013C2B4 File Offset: 0x0013A4B4
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 550816, RefRangeEnd = 550817, XrefRangeStart = 550809, XrefRangeEnd = 550816, 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: 0x06004F90 RID: 20368 RVA: 0x0013C31C File Offset: 0x0013A51C
	[CallerCount(1)]
	[CachedScanResults(RefRangeStart = 550818, RefRangeEnd = 550819, XrefRangeStart = 550817, XrefRangeEnd = 550818, 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: 0x06004F91 RID: 20369 RVA: 0x0013C384 File Offset: 0x0013A584
	[CallerCount(0)]
	[CachedScanResults(RefRangeStart = 0, RefRangeEnd = 0, XrefRangeStart = 550819, XrefRangeEnd = 550821, 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: 0x06004F92 RID: 20370 RVA: 0x0013C3E8 File Offset: 0x0013A5E8
	[CallerCount(0)]
	[CachedScanResults(RefRangeStart = 0, RefRangeEnd = 0, XrefRangeStart = 550821, XrefRangeEnd = 550832, 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: 0x06004F93 RID: 20371 RVA: 0x0013C450 File Offset: 0x0013A650
	[CallerCount(3)]
	[CachedScanResults(RefRangeStart = 550834, RefRangeEnd = 550837, XrefRangeStart = 550832, XrefRangeEnd = 550834, 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: 0x06004F94 RID: 20372 RVA: 0x0013C4C8 File Offset: 0x0013A6C8
	[CallerCount(0)]
	[CachedScanResults(RefRangeStart = 0, RefRangeEnd = 0, XrefRangeStart = 550837, XrefRangeEnd = 550843, 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: 0x06004F95 RID: 20373 RVA: 0x0013C514 File Offset: 0x0013A714
	// 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, 100668560);
		SpatialHashManager.NativeMethodInfoPtr_Add_Public_Void_Int32_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668561);
		SpatialHashManager.NativeMethodInfoPtr_Remove_Public_Void_Int32_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668562);
		SpatialHashManager.NativeMethodInfoPtr_FindNearUnits_Public_Dictionary_2_Int32_Vector3_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668563);
		SpatialHashManager.NativeMethodInfoPtr_ConvertFromWorldToCell_Private_Vector2Int_Vector3_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668564);
		SpatialHashManager.NativeMethodInfoPtr_GetSpatialHashGridData_Private_SpatialHashGridData_Int32_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668565);
		SpatialHashManager.NativeMethodInfoPtr_TryGetValidCellPos_Private_Boolean_Vector3_byref_Vector2Int_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668566);
		SpatialHashManager.NativeMethodInfoPtr__ctor_Public_Void_0 = IL2CPP.GetIl2CppMethodByToken(Il2CppClassPointerStore<SpatialHashManager>.NativeClassPtr, 100668567);
	}

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

	// Token: 0x17001C8E RID: 7310
	// (get) Token: 0x06004F97 RID: 20375 RVA: 0x0013C620 File Offset: 0x0013A820
	// (set) Token: 0x06004F98 RID: 20376 RVA: 0x0013C654 File Offset: 0x0013A854
	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: 0x17001C8F RID: 7311
	// (get) Token: 0x06004F99 RID: 20377 RVA: 0x0013C67C File Offset: 0x0013A87C
	// (set) Token: 0x06004F9A RID: 20378 RVA: 0x0013C6B0 File Offset: 0x0013A8B0
	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: 0x17001C90 RID: 7312
	// (get) Token: 0x06004F9B RID: 20379 RVA: 0x0013C6D8 File Offset: 0x0013A8D8
	// (set) Token: 0x06004F9C RID: 20380 RVA: 0x0013C70C File Offset: 0x0013A90C
	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: 0x04003452 RID: 13394
	private static readonly IntPtr NativeFieldInfoPtr_spatialHashSettings;

	// Token: 0x04003453 RID: 13395
	private static readonly IntPtr NativeFieldInfoPtr_spatialHashGridData;

	// Token: 0x04003454 RID: 13396
	private static readonly IntPtr NativeFieldInfoPtr_cells;

	// Token: 0x04003455 RID: 13397
	private static readonly IntPtr NativeMethodInfoPtr_Init_Public_Void_Int32_0;

	// Token: 0x04003456 RID: 13398
	private static readonly IntPtr NativeMethodInfoPtr_Add_Public_Void_Int32_Vector3_0;

	// Token: 0x04003457 RID: 13399
	private static readonly IntPtr NativeMethodInfoPtr_Remove_Public_Void_Int32_Vector3_0;

	// Token: 0x04003458 RID: 13400
	private static readonly IntPtr NativeMethodInfoPtr_FindNearUnits_Public_Dictionary_2_Int32_Vector3_Vector3_0;

	// Token: 0x04003459 RID: 13401
	private static readonly IntPtr NativeMethodInfoPtr_ConvertFromWorldToCell_Private_Vector2Int_Vector3_0;

	// Token: 0x0400345A RID: 13402
	private static readonly IntPtr NativeMethodInfoPtr_GetSpatialHashGridData_Private_SpatialHashGridData_Int32_0;

	// Token: 0x0400345B RID: 13403
	private static readonly IntPtr NativeMethodInfoPtr_TryGetValidCellPos_Private_Boolean_Vector3_byref_Vector2Int_0;

	// Token: 0x0400345C RID: 13404
	private static readonly IntPtr NativeMethodInfoPtr__ctor_Public_Void_0;
}
