/// <summary>
        /// Teleports player to dungeon
        /// </summary>
        /// <param name="entity">Entity</param>
        /// <param name="dungeon">Dungeon ID</param>
        internal void GoToDungeon(Entity entity, int map)
        {
            StoredWaypoints[entity].Add(new Waypoint {
                LevelId = GetLevelByEntity(entity).Id, Position = entity.Position
            });

            GetLevelByEntity(entity).RemoveEntity(entity);

            entity.CurrentLevel = map;

            Level newLevel = GetLevelByEntity(entity);

            newLevel.AddEntity(entity);

            if (!_cards.ContainsKey(entity))
            {
                _cards[entity] = new TitleCard {
                    CurrentTitle = newLevel.Title
                }
            }
            ;
            else
            {
                _cards[entity].CurrentTitle = newLevel.Title;
            }

            //TODO: Load this from an XML file, maybe?
            entity.Position = new Vector2(newLevel.Map.PixelSize.X / 2 - 20, newLevel.Map.PixelSize.Y - entity.Size.Y - 1);
        }
Esempio n. 2
0
        private void CreateAndSaveTitleCard(Item item)
        {
            var settings = WebConfigurationManager.AppSettings;
            int w        = int.Parse(settings["ThumbnailWidth"]);
            int h        = int.Parse(settings["ThumbnailHeight"]);

            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(w, h);
            var initial = item.Title.Length > 0 ? item.Title[0].ToString() : "";

            var generator = new TitleCard(
                graphics: System.Drawing.Graphics.FromImage(bitmap),
                strings: new string[] { item.AuthorName, item.Title },
                decorativeInitial: initial,
                stylingKeyString: item.AuthorLastName,
                width: w,
                height: h);

            generator.DrawBackground();
            generator.DrawForeground();

            var directory = HostingEnvironment.MapPath("~/Content/Thumbnails");

            System.IO.Directory.CreateDirectory(directory);
            var imagePath = System.IO.Path.Combine(directory, item.ExternalID + ".png");

            bitmap.Save(imagePath);
        }
Esempio n. 3
0
    public void buttonRestart()
    {
        EndCard.SetActive(false);

        ScoreCard.SetActive(false);
        CamPan();

        TitleCard.SetActive(true);
    }
Esempio n. 4
0
 public void buttonStart()
 {
     Score      = 0;
     levelScore = 0;
     ScoreCard.SetActive(true);
     endScore();
     TitleCard.SetActive(false);
     lm.NewGame(1);
     pc.backToSpawn();
     Playable = true;
 }
Esempio n. 5
0
 private void InitializeTitles()
 {
     Titles = new ObservableCollection <UIElement>();
     foreach (var title in _titlesMarkup.Titles)
     {
         var tvm = new TitleCardViewModel(title.Item);
         var tc  = new TitleCard {
             DataContext = tvm
         };
         Grid.SetRow(tc, title.Row);
         Grid.SetColumn(tc, TitleRowsCount + title.Column);
         Grid.SetRowSpan(tc, title.RowSpan);
         Grid.SetColumnSpan(tc, title.ColumnSpan);
         Titles.Add(tc);
     }
 }
Esempio n. 6
0
        public void Initialize()
        {
            width       = 200;
            height      = 100;
            bitmap      = new Bitmap(width, height);
            textStrings = new List <string>()
            {
                "Firstname Middlename Lastname", "A Multi-Word Title"
            };
            initial    = "L";
            keyString  = "Lastname";
            fgFontList = new List <string>()
            {
                "Calibri", "Arial"
            };
            bgFontList = new List <string>()
            {
                "Palatino", "Times New Roman"
            };
            lineLength = 40;

            titleCard = CreateTitleCard();
        }
        /// <summary>
        /// Screen sliding effect
        /// </summary>
        /// <param name="gameTime">Current game time</param>
        /// <param name="spriteBatch">Sprite batch for drawing</param>
        /// <param name="clientBounds">Window bounds</param>
        /// <param name="lv">Previous level</param>
        /// <param name="player">Player.</param>
        private void SlideScreen(GameTime gameTime, SpriteBatch spriteBatch, Rectangle clientBounds, Level lv, Entity player)
        {
            var     newLevel = GetLevel(player.TransitioningToLevel);
            Vector2 camera   = GetCameraPosition(player.CenterPosition, lv.Map.PixelSize, clientBounds);
            Vector2 camera2  = GetCameraPosition(player.CenterPosition, newLevel.Map.PixelSize, clientBounds);

            var cameraXTranslation = clientBounds.Width * player.LevelTransitionPercent;
            var cameraYTranslation = clientBounds.Height * player.LevelTransitionPercent;

            player.LevelTransitionPercent += (float)(gameTime.ElapsedGameTime.TotalMilliseconds / 1000);

            switch (player.LevelTransitionDirection)
            {
            case Direction.West:
                newLevel.Draw(gameTime, spriteBatch, new Vector2(newLevel.Map.PixelSize.X - clientBounds.Width + (clientBounds.Width - cameraXTranslation), camera2.Y));
                lv.Draw(gameTime, spriteBatch, new Vector2(-cameraXTranslation, camera.Y));
                player.Position = new Vector2(-(player.Size.X * player.LevelTransitionPercent), player.Position.Y);
                break;

            case Direction.East:
                newLevel.Draw(gameTime, spriteBatch, new Vector2(-clientBounds.Width + cameraXTranslation, camera2.Y));
                lv.Draw(gameTime, spriteBatch, new Vector2(camera.X + cameraXTranslation, camera.Y));
                player.Position = new Vector2(lv.Map.PixelSize.X - (player.Size.X * (1 - player.LevelTransitionPercent)), player.Position.Y);
                break;

            case Direction.South:
                newLevel.Draw(gameTime, spriteBatch, new Vector2(camera2.X, -clientBounds.Height + cameraYTranslation));
                lv.Draw(gameTime, spriteBatch, new Vector2(camera.X, camera.Y + cameraYTranslation));
                player.Position = new Vector2(player.Position.X, lv.Map.PixelSize.Y - (player.Size.Y * (1 - player.LevelTransitionPercent)));
                break;

            case Direction.North:
                newLevel.Draw(gameTime, spriteBatch, new Vector2(camera2.X, newLevel.Map.PixelSize.Y - clientBounds.Height + (clientBounds.Height - cameraYTranslation)));
                lv.Draw(gameTime, spriteBatch, new Vector2(camera.X, -cameraYTranslation));
                player.Position = new Vector2(player.Position.X, -(player.Size.Y * player.LevelTransitionPercent));
                break;

            default:
                player.LevelTransitionPercent = 1;
                break;
            }

            if (player.LevelTransitionPercent >= 1)
            {
                newLevel.AddEntity(player);
                lv.RemoveEntity(player);

                if (!_cards.ContainsKey(player))
                {
                    _cards[player] = new TitleCard {
                        CurrentTitle = newLevel.Title
                    }
                }
                ;
                else
                {
                    _cards[player].CurrentTitle = newLevel.Title;
                }

                player.CurrentLevel         = player.TransitioningToLevel;
                player.TransitioningToLevel = 0;
                switch (player.LevelTransitionDirection)
                {
                case Direction.West:
                    player.Position = new Vector2(newLevel.Map.PixelSize.X + player.Position.X, player.Position.Y);
                    break;

                case Direction.East:
                    player.Position = new Vector2(player.Position.X - lv.Map.PixelSize.X, player.Position.Y);
                    break;

                case Direction.North:
                    player.Position = new Vector2(player.Position.X, newLevel.Map.PixelSize.Y + player.Position.Y);
                    break;

                case Direction.South:
                    player.Position = new Vector2(player.Position.X, player.Position.Y - lv.Map.PixelSize.Y);
                    break;
                }

                player.LevelTransitionDirection = Direction.None;
                player.LevelTransitionPercent   = 0;
            }
        }
Esempio n. 8
0
 // Start is called before the first frame update
 void Start()
 {
     TitleCard.SetActive(true);
     pc = GameObject.Find("Player").GetComponent <PlayerController>();
     lm = GameObject.Find("Level Manager").GetComponent <LevelManager>();
 }
 void Awake()
 {
     current = this;
     msgText = GameObject.Find("NotificationText").GetComponent <Text>();
 }