Esempio n. 1
0
        public TArea Advance(IDecisionManager decisionManager, Team advancingTeam)
        {
            TArea newArea;

            if (typeof(TArea) == typeof(Region))
            {
                Region currentRegion = CurrentArea as Region;

                RegionCompletedEventArgs e = new RegionCompletedEventArgs(currentRegion);
                currentRegion?.OnRegionCompleted(e);
            }
            if (typeof(TArea) == typeof(SubRegion))
            {
                SubRegion currentSubRegion = CurrentArea as SubRegion;

                SubRegionCompletedEventArgs e = new SubRegionCompletedEventArgs(currentSubRegion);
                currentSubRegion?.OnSubRegionCompleted(e);
            }

            MapPath <TArea, TAreaId> currentPath = MapPaths.First(p => p.From.Equals(CurrentArea));

            List <TArea> availableAreas = currentPath.To.GetAvaialableAreas().ToList();

            if (availableAreas.Count == 0)
            {
                newArea = null;
            }
            else if (availableAreas.Count == 1)
            {
                newArea = availableAreas[0];
            }
            else
            {
                newArea = decisionManager.PickNextArea(currentPath.To, advancingTeam);
            }

            CurrentArea = newArea;
            return(newArea);
        }
Esempio n. 2
0
        public void PleaseDeleteMeIAmTerribleCode(object sender, FooEventArgs e)
        {
            MapGrouping <SubRegion, WorldSubRegion> grouping = _mapManager.GetGrouping <SubRegion, WorldSubRegion>(e.GroupingId);

            _decisionManager.PickNextArea(grouping, _playerTeam);
        }