Пример #1
0
        private void CheckConflict(AMoveAction character)
        {
            var conflict = false;

            if (character is PlayerMoveAction)
            {
                conflict = conflictChecker.PlayerConflict(character, MapData.ListMap);
            }
            else if (character is EnemyMoveAction)
            {
                conflict = conflictChecker.EnemyConflict(character, MapData.ListMap);
            }

            if (conflict)
            {
                var enemyList = MapData.EnemyList;
                var index     = enemyList.FindIndex(x => x.Pos == character.Pos);
                var hasKey    = false;
                if (enemyList[index].PortalKey != null && moveAction.PortalKey == null)
                {
                    moveAction.PortalKey       = enemyList[index].PortalKey;
                    enemyList[index].PortalKey = null;
                    hasKey = true;
                }
                NavigateToPage(new BattlePage(enemyElement, hasKey));

                CharacterField.Children.RemoveAt(index + 2);
                enemyList.RemoveAt(index);
            }
        }
Пример #2
0
        private void SwitchLevel(AMoveAction player)
        {
            Dictionary <int, int> switchPos = new Dictionary <int, int>()
            {
                { 0, 16 }, { 17, 1 }
            };
            var path   = MapData.PathsLevel.Where(p => p.PathPos.X == player.Pos.X || p.PathPos.Y == player.Pos.Y).FirstOrDefault();
            var newMap = App.levelList.LevelsList.Where(m => m.RoomID == path.RoomID).FirstOrDefault();
            var X      = (int)player.Pos.X;
            var Y      = (int)player.Pos.Y;

            if (path.PathPos.X == 0 || path.PathPos.X == 17)
            {
                X = switchPos[(int)path.PathPos.X];
            }

            if (path.PathPos.Y == 0 || path.PathPos.Y == 17)
            {
                Y = switchPos[(int)path.PathPos.Y];
            }

            MapData.SetZeroOnMapData(player.LastPos);

            player.Pos = new Point(X, Y);

            LoadMapData(newMap);
        }
Пример #3
0
 public bool PortalConflict(AMoveAction character, List <List <int> > ListMap)
 {
     if (ListMap[(int)character.Pos.X][(int)character.Pos.Y] == 4)
     {
         return(true);
     }
     return(false);
 }
Пример #4
0
 public bool PlayerNextLevel(AMoveAction character, List <List <int> > ListMap)
 {
     if (ListMap[(int)character.Pos.X][(int)character.Pos.Y] == 3)
     {
         return(true);
     }
     return(false);
 }