예제 #1
0
파일: Game1.cs 프로젝트: Siryu/RPG-game
        private void TextToScreen(string text)
        {
            ConversationHandlerAction endConversation = new ConversationHandlerAction("EndConversation", null);
            ConversationHandler handler = new ConversationHandler("Continue", endConversation);
            Conversation textDialog = new Conversation("text", text, handler);

            this.dialog.Enabled = true;
            this.dialog.Visible = true;
            this.dialog.FirstFrame = true;
            this.dialog.Conversation = textDialog;
            NPC textNPC = new NPC(null, dialog, null);
            this.dialog.Npc = textNPC;
            textNPC.StartConversation("text");
        }
예제 #2
0
파일: Game1.cs 프로젝트: Siryu/RPG-game
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            treasureChestTexture = Texture2D.FromStream(GraphicsDevice, new System.IO.StreamReader("content/treasurechest.png").BaseStream);
            doorTexture = Texture2D.FromStream(GraphicsDevice, new System.IO.StreamReader("content/door.png").BaseStream);

            tileMap = Content.Load<TileMap>("Maps/OneHouseTest");

            sprite = new AnimatedSprite(Content.Load<Texture2D>("Sprites/npc3"));
            sprite.OriginOffset = new Vector2(16, 30);

            NPC npc = new NPC(Content.Load<Texture2D>("Sprites/npc3"), dialog, Content.Load<Script>("Scripts/NPC1"));
            npc.Target = sprite;
            npcs.Add(npc);

            npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/amg2"), null, null));
            npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/avt1"), null, null));
            npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/avt2"), null, null));
            npcs.Add(new NPC(Content.Load<Texture2D>("Sprites/npc6"), null, null));
        }
예제 #3
0
파일: Script.cs 프로젝트: Siryu/RPG-game
 public void Invoke(NPC npc)
 {
     method.Invoke(npc, parameters);
 }
예제 #4
0
파일: Script.cs 프로젝트: Siryu/RPG-game
 public void Invoke(NPC npc)
 {
     foreach (ConversationHandlerAction action in actions)
         action.Invoke(npc);
 }
예제 #5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            tileMap.Layers.Add(TileLayer.FromFile(Content, "Layouts/Layer1.layer"));
            tileMap.Layers.Add(TileLayer.FromFile(Content, "Layouts/Layer3.layer"));
            tileMap.CollisionLayer = CollisionLayer.FromFile("Content", "Layouts/Collision.layer");

            scripts.Add("NPC1", Content.Load<Script>("Scripts/NPC1"));

            playerSprite = new AnimatedSprite(Content.Load<Texture2D>("Sprites/image (1)_strip"), 0);
            playerSprite.OriginOffset = new Vector2(16, 30);

            EntityManager.Instance.RegisterEntity(playerSprite);
            npc = new NPC(Content.Load<Texture2D>("Sprites/image (1)_strip"), scripts["NPC1"], 1);
            EntityManager.Instance.RegisterEntity(npc);
            npcs.Add(npc.Id, npc);

            npc = new NPC(Content.Load<Texture2D>("Sprites/image (11)_strip"), null, 2);
            EntityManager.Instance.RegisterEntity(npc);
            npcs.Add(npc.Id, npc);

            npc = new NPC(Content.Load<Texture2D>("Sprites/image (2)_strip"), null, 3);
            EntityManager.Instance.RegisterEntity(npc);
            npcs.Add(npc.Id, npc);

            npc = new NPC(Content.Load<Texture2D>("Sprites/image (7)_strip"), null, 4);
            EntityManager.Instance.RegisterEntity(npc);
            npcs.Add(npc.Id, npc);
        }