void Start () { //THERE CAN BE ONLY ONE if (mapController != null && mapController != this) { Destroy (this.gameObject); return; } mapController = this; GameObject tileMap_go = transform.FindChild ("TileMap").gameObject; if (tileMap_go) { tileMap = tileMap_go.GetComponent<TileMapController> (); } else { Debug.LogError ("TileMap not found"); } GameObject heroes_go = GameObject.Find ("Heroes"); if (heroes_go) { heroes_go.transform.SetParent (this.transform); heroes = heroes_go.GetComponent<HeroesController> (); } else { Debug.LogError ("Heroes GameObject not found"); } tileMap.CreateTileMap (); heroes.CreateHeroMap (); tileHighlightPrefab = (GameObject) Resources.Load ("UI/TileHighlight"); pathfinder = new PathfinderDijkstra (); }
void Start() { pathfinder = GetComponent <PathfinderDijkstra>(); thePath = pathfinder.GetPath(nodeCreator.GetNodeByPosition(transform.position), nodeCreator.GetNodeByPosition(mine.transform.position)); id = 0; destiny = Vector3.zero; }