public SPTerrainRect GetSPTerrainRect(Vector3 position) { if (position == Vector3.zero) { return(null); } IntVector4 node = AiUtil.ConvertToIntVector4(position, 3); IntVector2 mark = new IntVector2(node.x, node.z); if (pointTable.ContainsKey(mark)) { return(pointTable[mark]); } return(null); }
public void RegisterSPPoint(SPPoint point, bool updateIndex = false) { if (point == null) { return; } IntVector4 node = AiUtil.ConvertToIntVector4(point.position, 3); IntVector2 mark = new IntVector2(node.x, node.z); if (pointTable.ContainsKey(mark)) { pointTable[mark].RegisterSPPoint(point); if (updateIndex) { point.index = pointTable[mark].nextIndex; } } }
bool GetPositionAndRotation(AISpawnData data, out Vector3 pos, out Quaternion rot, out Vector3 target) { pos = Vector3.zero; rot = Quaternion.identity; target = Vector3.zero; Vector3 point = GetRandom(); if (point != Vector3.zero) { IntVector4 node = AiUtil.ConvertToIntVector4(point, 0); //IntVector2 vec2 = new IntVector2(node.x, node.z); //if (AiManager.Manager.colliders.ContainsKey(vec2)) //{ // Vector3 center = point; // if (CSMain.s_MgCreator.Assembly != null) // center = CSMain.s_MgCreator.Assembly.Position; // pos = GetRandomPosition(data, center); // target = point; //} //else { pos = GetPosition(node); target = Vector3.zero; } //pos = GetPositionFromCollider(node); if (pos != Vector3.zero) { rot = Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up); return(true); } } return(false); }