Exemplo n.º 1
0
 public void FinishBossFight()
 {
     lastBossFight         = currentBossFight;
     lastBossFightDuration = (DateTime.Now - currentBossStartTime);
     currentActivity       = InGameActivity.WALKING;
     currentBossFight      = null;
 }
 private static bool Matches(BossFight bossFight, HashSet <Boss> startingBosses, Music music, Map map, MapTileCoordinate mapTile)
 {
     if (bossFight.startingBosses != null && !bossFight.startingBosses.SetEquals(startingBosses))
     {
         return(false);
     }
     if (bossFight.extraCondition == null)
     {
         return(true);
     }
     return(bossFight.extraCondition(startingBosses, music, map, mapTile));
 }
        static BossFightIdentifier()
        {
            // Build dictionaries here.
            var specifiedMapTile     = new List <BossFight>();
            var specifiedMusicAndMap = new List <BossFight>();
            var specifiedMusicOnly   = new List <BossFight>();
            var specifiedMapOnly     = new List <BossFight>();
            var specifiedNeither     = new List <BossFight>();

            foreach (var bossFight in BossFight.GetBossFights())
            {
                if (bossFight == null || bossFight == BossFight.UNKNOWN)
                {
                    continue;
                }

                if (bossFight.mapTile != null)
                {
                    specifiedMapTile.Add(bossFight);
                    continue;
                }

                if (bossFight.music != null)
                {
                    if (bossFight.map != null)
                    {
                        specifiedMusicAndMap.Add(bossFight);
                    }
                    else
                    {
                        specifiedMusicOnly.Add(bossFight);
                    }
                }
                else
                {
                    if (bossFight.map != null)
                    {
                        specifiedMapOnly.Add(bossFight);
                    }
                    else
                    {
                        specifiedNeither.Add(bossFight);
                    }
                }
            }

            _matchMapTile          = specifiedMapTile.ToLookup(bossFight => bossFight.mapTile.Value, bossFight => bossFight);
            _matchMusicAndMap      = specifiedMusicAndMap.ToLookup(bossFight => new Tuple <Music, Map>(bossFight.music.Value, bossFight.map.Value), bossFight => bossFight);
            _matchMusic            = specifiedMusicOnly.ToLookup(bossFight => bossFight.music.Value, bossFight => bossFight);
            _matchMap              = specifiedMapOnly.ToLookup(bossFight => bossFight.map.Value, bossFight => bossFight);
            _remainingDescriptions = specifiedNeither.ToArray();
        }
Exemplo n.º 4
0
        private static BossFight[] GetAllBossFights()
        {
            var type   = typeof(BossFight);
            var fields = type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);

            var bossFights = new List <BossFight>();

            foreach (var info in fields)
            {
                var instance     = new BossFight();
                var locatedValue = info.GetValue(instance) as BossFight;

                if (locatedValue != null && locatedValue != BossFight.UNKNOWN)
                {
                    bossFights.Add(locatedValue);
                }
            }

            return(bossFights.ToArray());
        }
Exemplo n.º 5
0
 public void StopBossFight()
 {
     currentActivity  = InGameActivity.WALKING;
     currentBossFight = null;
 }
Exemplo n.º 6
0
 public void StartBossFight(BossFight bossFight)
 {
     currentActivity      = InGameActivity.BOSS_BATTLE;
     currentBossStartTime = DateTime.Now;
     currentBossFight     = bossFight;
 }
Exemplo n.º 7
0
 public InGameState()
 {
     currentActivity  = InGameActivity.STARTING;
     currentBossFight = null;
     lastBossFight    = null;
 }