Vector3 GetNearbyPosition(Vector2 mapPos) { float minX = Mathf.Max(1, mapPos.x - 4.0f); float maxX = Mathf.Min(m_influenceMap.GetSize() - 1, mapPos.x + 4.0f); float minZ = Mathf.Max(1, mapPos.y - 4.0f); float maxZ = Mathf.Min(m_influenceMap.GetSize() - 1, mapPos.y + 4.0f); int newX = Mathf.RoundToInt(Random.Range(minX, maxX)); int newY = Mathf.RoundToInt(Random.Range(minZ, maxZ)); Vector2 temp = m_influenceMap.Indices2World(newX, newY); return(new Vector3(temp.x, transform.position.y, temp.y)); }
void Start() { m_influenceMap = GetComponent <InfluenceMap>(); m_mapSize = m_influenceMap.GetSize(); m_movement = gameObject.GetComponent <SeekerMovement>(); }