Пример #1
0
        public void ExitedDialogue(object sender, DialogueEventArgs e)
        {
            Console.WriteLine(e.exitNumber);

            switch (e.exitNumber)
            {
                case 0:
                    isInteracting = false;
                    dialogue.isTalking = false;
                    Game1.currentGameState = Game1.GameState.PLAY;
                    break;

                case 1:
                    attackPlayer = true;
                    break;

                case 2:
                    if (key != null)
                    {
                        key.position = Game1.character.positionRectangle;
                        Game1.keys.Add(key);
                        key = null;
                    }
                    if (quest != null)
                    {
                        quest.completed = true;
                    }
                    break;

                case 3:
                    if (name == "Ziva" && Game1.testBoss.health > 0)
                    {
                        Game1.testBoss.attackPlayer = true;
                    }
                    health = 0;
                    break;

                case 4:
                    if (sword != null)
                    {
                        Game1.character.GetSword(sword, game);
                    }
                    break;

                case 5:
                    if (secondDialogue != "null")
                    {
                        dialogue.dialogueManager = new DialogueManager(@"Content\npc\dialogue\" + secondDialogue + ".txt");
                        dialogue.dialogueManager.ReachedExit += ExitedDialogue;
                    }
                    break;

                case 6:
                    if (sword != null)
                    {
                        Game1.character.GetSword(sword, game);
                        sword = null;
                    }
                    if (secondDialogue != "null")
                    {
                        dialogue.dialogueManager = new DialogueManager(@"Content\npc\dialogue\" + secondDialogue + ".txt");
                        dialogue.dialogueManager.ReachedExit += ExitedDialogue;
                    }
                    break;
                case 7:
                    if (quest != null)
                    {
                        quest.Accept(game);
                    }
                    break;
                default:
                    isInteracting = false;
                    dialogue.isTalking = false;
                    Game1.currentGameState = Game1.GameState.PLAY;
                    break;
            }
        }
Пример #2
0
        public Npc(string mapName, string name, int x, int y, int width, int height, bool up, bool down, bool left, bool right,
            string spritePath, string portraitPath, bool patrolNone, bool patrolUpDown, bool patrolLeftRight,
            bool patrolBox, int patrolX, int patrolY, int patrolWidth, int patrolHeight, float speed, Game1 game,
            string dialoguePath, string keyName, string secondDialogue, string thirdDialogue)
        {
            position = new Rectangle(x, y, 50, 71);
            this.name = name;
            this.mapName = mapName;
            this.up = up;
            this.down = down;
            this.left = left;
            this.right = right;
            vulnerable = true;
            minDamage = 2;
            maxDamage = 15;
            patrolRect = new Rectangle(patrolX, patrolY, patrolWidth, patrolHeight);
            aTexture = game.Content.Load<Texture2D>(@"Npc\A");
            aPosition = new Rectangle(0, 0, aTexture.Width, aTexture.Height);
            health = 200;
            maxHealth = health;
            this.speed = speed;
            this.game = game;

            if (name != "Informer")
            {
                dialogue = new Dialogue(game.Content.Load<Texture2D>(@"npc\portrait\" + portraitPath), Game1.textBox, game, Game1.spriteFont, dialoguePath, name);
                walkSprite = game.Content.Load<Texture2D>(@"npc\sprite\" + spritePath);
            }

            debugTile = game.Content.Load<Texture2D>(@"Player\emptySlot");
            healthTexture = game.Content.Load<Texture2D>(@"Game\health100");
            aColor = Color.White;
            DEATH = 8;
            if (name == "Celine")
            {
                animation = new AnimationComponent(2, 9, 50, 72, 175, Microsoft.Xna.Framework.Point.Zero);
                position.Height = 72;
                sword = new Game.Items.Sword("cockiri", 17, 27);//3, 17
                waypoint = new WaypointManager(name, "Map3_B", 2);
            }
            else if (name == "Headmaster")
            {
                animation = new AnimationComponent(2, 9, 50, 127, 175, Microsoft.Xna.Framework.Point.Zero);
                vulnerable = false;
                position.Y -= 60;
                position.Height = 127;

                waypoint = new WaypointManager(name, "Map3_B", 3);
            }
            else if (name == "Lamia")
            {
                animation = new AnimationComponent(2, 4, 100, 76, 175, Microsoft.Xna.Framework.Point.Zero);
                position.Y -= 64;
                position.Height = 64;
                position.Width = 84;
            }
            else if (name == "Laune")
            {
                animation = new AnimationComponent(3, 11, 50, 75, 175, Microsoft.Xna.Framework.Point.Zero);

            }
            else if (name == "Informer")
            {
                if (spritePath == @"Player\maleSheet")
                {
                    animation = new AnimationComponent(4, 13, 50, 70, 150, Microsoft.Xna.Framework.Point.Zero);
                }
                else
                {
                    animation = new AnimationComponent(4, 4, 41, 70, 150, Microsoft.Xna.Framework.Point.Zero);
                }
            }
            else if (name == "Sylian")
            {
                quest = new Quest(Game1.ribbon.item, this.name);
                animation = new AnimationComponent(2, 4, 50, 71, 175, Microsoft.Xna.Framework.Point.Zero);
            }
            else
            {
                animation = new AnimationComponent(2, 4, 50, 71, 175, Microsoft.Xna.Framework.Point.Zero);
            }

            mob = false;

            dialogue.dialogueManager.ReachedExit += ExitedDialogue;
            if (keyName != "nokey")
            {
                key = new Key(Rectangle.Empty, keyName, game.keyTexture, this.mapName, game);
            }

            this.secondDialogue = secondDialogue;
            this.thirdDialogue = thirdDialogue;
        }