Exemplo n.º 1
0
 //Set text to be displayed with interval between printing new letters
 public void SetText(string text, int letterInterval)
 {
     Text         = text;
     TextInterval = letterInterval;
     ShownText    = "";
     TextAnimationMgr.AddEvent(new Event <Screen>(letterInterval, AddLetter, this));
 }
Exemplo n.º 2
0
        //Like Map.Update, updates player, NPCs, items, events and displayed text. Also advances the intro/outro as needed and checks for task completion
        public override void Update(GameTime gameTime, KeyboardState keyboardState)
        {
            Player.Update(gameTime, keyboardState);
            UpdateNPCs(gameTime);
            UpdateItems(gameTime);
            UpdateEvents();
            TextAnimationMgr.Update();

            if (CheckOutOfMap((int)Player.Position.Y) == -1)
            {
                //player fell down, reset player
                ResetPlayer();
            }

            //Player entered the "red door"
            if (exitZone != null && CheckZone(exitZone))
            {
                Game.Dialogue = new Dialogue(device, this, "Start your adventure now?", delegate { exitZone = null; Game.endIntro = true; Game.Loading = new Loading(device, this, "Game is now loading..."); }, delegate { ResetPlayer(); });
            }

            //Player is trying to reach all "green doors"
            if (movementTestZones != null)
            {
                foreach (Zone z in movementTestZones)
                {
                    if (CheckZone(z))
                    {
                        z.Deactivate();
                    }
                }

                //Success, create next task
                if (!movementTestZones.Any(x => x.Active == true))
                {
                    movementTestZones = null;
                    SetText("Good.\nNow there is an Item and an NPC (which can move around and attack you).\nUse your action keys to pick the item up (K) and attack the NPC (J)!", 50);
                    NPCs.Add(new NPC(device, this, new Vector2(400, 400), 0, tiles[0], 32, 32));
                    items.Add(new Item(this, device, Item.ItemType.Weapon, 0, new Vector2(600, 600), 0, 16, 16, true, null, new ItemProperties("ITEM")));
                }
            }

            if (Player.HeldItem != null)
            {
                pickedUpItem = true;
            }

            //Item picked up and NPC is dead, show red door and last part of text
            if (!lastStage && pickedUpItem && NPCs.Count == 0) //0 NPCs if item has been held means that the NPC is dead
            {
                lastStage = true;
                SetText("Well done!\nYou seem ready, " + Player.Name + ".\nYour objective in the game is to complete all the quests.\nIf you can't or don't want to, press ESC to end the current map and see\ngame statistics.\n\nTo start the game, jump through the red door.", 50);
                exitZone = GetScreenZone(device, Color.Red);
            }
        }