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"); }
/// <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)); }
public void Invoke(NPC npc) { method.Invoke(npc, parameters); }
public void Invoke(NPC npc) { foreach (ConversationHandlerAction action in actions) action.Invoke(npc); }
/// <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); }