Exemple #1
0
    } // 배경 오브젝트들을 설정한 위치를 기준으로 생성합니다.

    public threatTriggerNode triggerCheck(mapNode trigerObj, Score checkScore)
    {
        threatTriggerNode result = new threatTriggerNode();

        result.progress = 0;
        result.trigger  = false;
        result.logs     = new List <string>();
        switch (trigerObj.type)
        {
        case "hunt":
            int huntedCount = 0;
            foreach (int huntedMonsterNumber in trigerObj.monsterList)
            {
                if (checkScore.killScore.ContainsKey(huntedMonsterNumber))
                {
                    huntedCount += checkScore.killScore[huntedMonsterNumber];

                    result.logs.Add(huntedMonsterNumber + ": (" + checkScore.killScore[huntedMonsterNumber] + "/" + trigerObj.count + ") 사냥됨.");
                }
            }

            result.progress = huntedCount == 0 ? 0 : (huntedCount / (float)trigerObj.count);

            if (huntedCount >= trigerObj.count)
            {
                result.trigger = true;
            }
            break;
        }

        return(result);
    } // 위협 조건하나가 성립됐는지 확인
Exemple #2
0
            public int Compare(object O1, object O2)
            {
                mapNode mn1 = (mapNode)O1;
                mapNode mn2 = (mapNode)O2;

                return((int)(mn1.distance - mn2.distance));
            }
Exemple #3
0
        public List <MapLink> BuildRouteToNearestType(MapPoint start, EntityTypes entityType)
        {
            List <MapLink> result = new List <MapLink>();

            mapNode         beginning = null;
            mapNode         ending    = null;
            PlottedMapPoint pStart    = (PlottedMapPoint)_mappedPoints[start.Id];

            if ((pStart.EntityTypes & entityType) == entityType)
            {
                return(result);
            }



            Dictionary <int, mapNode> nodes = new Dictionary <int, mapNode>();

            beginning = new mapNode(pStart, 0);
            nodes.Add(pStart.MapPoint.Id, beginning);

            foreach (DictionaryEntry entry in _mappedPoints)
            {
                if (nodes.ContainsKey(((PlottedMapPoint)entry.Value).MapPoint.Id))
                {
                    continue;
                }

                mapNode node = new mapNode((PlottedMapPoint)entry.Value, double.MaxValue);
                nodes.Add(node.MapPoint.MapPoint.Id, node);
            }


            SortableList openList = new SortableList(new MapNodeComparer());

            openList.KeepSorted    = true;
            openList.AddDuplicates = true;

            openList.Add(beginning);
            Dictionary <int, mapNode> closedList = new Dictionary <int, mapNode>();

            bool found = false;

            while ((!found) && (openList.Count > 0))
            {
                mapNode current = (mapNode)openList[0];
                if ((current.MapPoint.EntityTypes & entityType) == entityType)
                {
                    found  = true;
                    ending = current;
                }
                else
                {
                    closedList.Add(current.MapPoint.MapPoint.Id, current);
                    openList.Remove(current);

                    foreach (MapLink link in current.MapPoint.Links)
                    {
                        PlottedMapPoint end  = (PlottedMapPoint)_mappedPoints[link.End.Id];
                        mapNode         nEnd = nodes[link.End.Id];

                        double distance = 0;
                        if (link.LinkType == LinkType.Teleport)
                        {
                            distance = 2000 + current.distance;
                        }
                        else
                        {
                            distance = current.Location.Distance(end.Location) + current.distance;
                        }

                        if (distance < nEnd.distance)
                        {
                            nEnd.distance = distance;
                            nEnd.Parent   = current;
                            nEnd.link     = link;
                            if ((!closedList.ContainsKey(end.MapPoint.Id)) && (!_sortedListContains(openList, nEnd)))
                            {
                                openList.Add(nEnd);
                            }
                        }
                    }
                }
            }

            if (found)
            {
                mapNode node = ending;
                while (node != beginning)
                {
                    result.Insert(0, node.link);
                    node = node.Parent;
                }
            }



            return(result);
        }