コード例 #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
ファイル: Game1.cs プロジェクト: soshimozi/XNATileEngine
        /// <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);
        }