public void OnEnable() { // Finding all the references. this.uiCanvas = GameObject.Find("Canvas"); if (!this.uiCanvas) { Debug.LogError("There needs to be one active Canvas GameObject in your scene."); } this.playerParty = GameObject.Find("CharacterList"); if (!this.uiCanvas) { Debug.LogError("There needs to be one active CharacterList GameObject in your scene."); } this.audioManager = FindObjectOfType(typeof(Manager)) as Manager; if (!this.uiCanvas) { Debug.LogError("There needs to be one active Manager script on a GameObject in your scene."); } // Other references this.currentLevelUi = this.uiCanvas.GetComponent <CurrentLevel>(); this.routesGenerator = this.uiCanvas.GetComponent <RoutesGenerator>(); }
/// <summary> /// Initialize the graph of the city using CityScoverRepository. /// </summary> private void InitializeTour() { CityScoverRepository.LoadPoints(WorkingConfiguration.PointsFilename); Points = (WorkingConfiguration.TourCategory == TourCategoryType.None) ? CityScoverRepository.Points : GetPointsByCategory(WorkingConfiguration.TourCategory); RoutesGenerator.GenerateRoutes(Points, Points.Count()); CityScoverRepository.LoadRoutes(Points); // Creation of the Graph. CityMapGraph cityGraph = new CityMapGraph(); foreach (var point in Points) { cityGraph.AddNode(point.Id, new InterestPointWorker(point)); } var routes = CityScoverRepository.Routes; foreach (var route in routes) { cityGraph.AddEdge(route.PointFrom.Id, route.PointTo.Id, new RouteWorker(route)); } if (cityGraph.NodeCount == 0) { string message = MessagesRepository.GetMessage( MessageCode.SolverGraphCreationError, nameof(InitializeTour)); throw new Exception(message); } CityMapGraph = cityGraph; }
public void NewGame() { // Get a new BGM GameObject bgm = GameObject.Find("BGM Manager"); Manager manager = bgm.GetComponent <Manager>(); manager.UpdateBGM(); RoutesGenerator routes = this.GetComponent <RoutesGenerator>(); routes.Toggle(); }
public void HandleClick() { // Call Battle function here BattleManager.Instance.ShouldStartBattle(); // Close the choice panel GameObject canvas = GameObject.Find("Canvas"); RoutesGenerator routes = canvas.GetComponent <RoutesGenerator>(); routes.Toggle(); // Update Current Level CurrentLevel currentLevel = canvas.GetComponent <CurrentLevel>(); currentLevel.UpdateLevelInfo(); Debug.Log(title.text); }
public void HandleconfirmButton() { // Create a child clone under the parent Inventory Inventory inventory = Resources.FindObjectsOfTypeAll <Inventory>()[0]; inventory.addModules(this.loot); // Close the tooltip panel this.Toggle(); // Close the loot panel GameObject canvas = GameObject.Find("Canvas"); LootGenerator loot = canvas.GetComponent <LootGenerator>(); loot.Toggle(); // Open the route panel RoutesGenerator routes = canvas.GetComponent <RoutesGenerator>(); routes.Toggle(); }