private void Start() { NodeNavMesh navMesh = FindObjectOfType <NodeNavMesh>(); Node mNode = navMesh.NodeFromWorldPoint(transform.position); nodes = navMesh.GetNodesArraund(mNode, ((int)RadiusSpawnArea / 2)); StartCoroutine(Spawning()); }
public static NodeNavMesh CreateNavMesh(GameObject where, Tilemap worldTerrain) { where.SetActive(false); NodeNavMesh myC = where.AddComponent <NodeNavMesh>(); myC.worldTerrain = worldTerrain; where.SetActive(true); return(myC); }
private void Awake() { pixelShader = Resources.Load <Material>("Materials/PixelSnapMat"); ground = Resources.Load <Tile>("Tiles/Ground_Tile"); backGround = Resources.Load <Tile>("Tiles/BackGround_Tile"); SpawnerPrefab = Resources.Load <GameObject>("Prefabs/Spawner"); chunkSize = GameManager.Instance.Settings.chunkSize; width = worldInfo.worldSizeInChunks.x; heigth = worldInfo.worldSizeInChunks.y; if (worldInfo.chunks == null) { worldInfo.chunks = new ChunkInfo[width][]; for (int i = 0; i < width; i++) { worldInfo.chunks[i] = new ChunkInfo[heigth]; } } SetWorldColor(worldInfo.color); Physics2D.gravity = new Vector2(0, worldInfo.gravity); int layers = 2; for (int i = 0; i < layers; i++) { tileMaps.Add(SetupTilemap()); } SetDungeons(); SetUpWorld(); navMesh = NodeNavMesh.CreateNavMesh(gameObject, tileMaps[0]); tileMaps[0].GetComponent <TilemapRenderer>().material = Resources.Load <Material>("Materials/GoundMat"); tileMaps[0].GetComponent <TilemapRenderer>().material.SetColor("_Color1", worldInfo.color); SetSpawners(); SetWorldLimits(); FindObjectOfType <Player>().OnDiggingToDir += CheckDestruction; worldInfo.Save(); TransformUtility.ChangeLayersRecursively(transform, gameObject.layer); }
private void Awake() { owner = GetComponent <AICharacter>(); nodeMesh = FindObjectOfType <NodeNavMesh>();//Get a reference to the game manager isStopped = true; }
private void Awake() { world = FindObjectOfType <NodeNavMesh>(); }