Esempio n. 1
0
    private void DrawRoute(int startIndex, int endIndex, List <RouteTypes> routeTypes)
    {
        int             index = routeIndex++;
        ChapterMapRoute r     = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.ChapterMapRoute].AllocateGameObject <ChapterMapRoute>(ChapterMapRoutesTransform);

        r.Refresh(nodeLocations[startIndex], nodeLocations[endIndex], index, startIndex, endIndex);
        ChapterMapNodes[startIndex].AdjacentRoutes.Add(index);
        ChapterMapNodes[endIndex].AdjacentRoutes.Add(index);
        ChapterMapRoutes.Add(index, r);
        foreach (RouteTypes routeType in routeTypes)
        {
            RouteCategory[routeType].Add(index);
        }
    }
Esempio n. 2
0
    public void RefreshKnownLevels()
    {
        foreach (KeyValuePair <int, ChapterMapNode> kv in ChapterMapNodes)
        {
            kv.Value.IsSelected = false;
            kv.Value.IsHovered  = false;
            kv.Value.IsBeated   = false;
        }

        foreach (KeyValuePair <int, ChapterMapNode> kv in ChapterMapNodes)
        {
            kv.Value.gameObject.SetActive(false);
        }

        foreach (KeyValuePair <int, ChapterMapRoute> kv in ChapterMapRoutes)
        {
            kv.Value.SetRouteState(ChapterMapRoute.RouteStates.None);
        }

        foreach (KeyValuePair <int, bool> kv in Cur_Chapter.LevelBeatedDictionary)
        {
            ChapterMapNodes[kv.Key].IsBeated = kv.Value;
            ChapterMapNodes[kv.Key].gameObject.SetActive(kv.Value);
        }

        foreach (KeyValuePair <int, bool> kv in Cur_Chapter.LevelBeatedDictionary)
        {
            foreach (int ri in ChapterMapNodes[kv.Key].AdjacentRoutes)
            {
                ChapterMapRoute route = ChapterMapRoutes[ri];

                bool hasLevel_0 = Cur_Chapter.LevelBeatedDictionary.ContainsKey(route.NodeIndex_0);
                bool beated_0   = hasLevel_0 && Cur_Chapter.LevelBeatedDictionary[route.NodeIndex_0];
                bool hasLevel_1 = Cur_Chapter.LevelBeatedDictionary.ContainsKey(route.NodeIndex_1);
                bool beated_1   = hasLevel_1 && Cur_Chapter.LevelBeatedDictionary[route.NodeIndex_1];

                if (beated_0 && beated_1)
                {
                    ChapterMapNodes[route.NodeIndex_0].gameObject.SetActive(hasLevel_0);
                    ChapterMapNodes[route.NodeIndex_1].gameObject.SetActive(hasLevel_1);
                    route.SetRouteState(ChapterMapRoute.RouteStates.Conquered);
                }
                else if (beated_0 || beated_1)
                {
                    ChapterMapNodes[route.NodeIndex_0].gameObject.SetActive(hasLevel_0);
                    ChapterMapNodes[route.NodeIndex_1].gameObject.SetActive(hasLevel_1);

                    if (hasLevel_0 && hasLevel_1)
                    {
                        route.SetRouteState(ChapterMapRoute.RouteStates.NextStep);
                    }
                    else
                    {
                        route.SetRouteState(ChapterMapRoute.RouteStates.None);
                    }
                }
                else
                {
                    if (hasLevel_0 && hasLevel_1)
                    {
                        route.SetRouteState(ChapterMapRoute.RouteStates.Dashed);
                    }
                    else
                    {
                        route.SetRouteState(ChapterMapRoute.RouteStates.None);
                    }
                }
            }
        }

        ChapterMapNodes[0].gameObject.SetActive(true);
    }