Ejemplo n.º 1
0
        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>();
        }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
    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();
    }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
    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();
    }