Esempio n. 1
0
        private void addNPCS()
        {
            NPC testNpc = new NPC("TEST", this, new Vector2(3, 6), 1, new Vector2(30, 30), new Vector2(30, 50), 0);

            ChatPage page1 = new ChatPage();
            ChatPage page2 = new ChatPage();
            ChatPage page3 = new ChatPage();

            page1.setText(@"This is the test long string that will be parsed into small strings and individually drawn based on the text speed and such. " +
                "These next couple sentences are to test having a string that is longer than 9 lines. Blah blah blah blah poop poop poop fart fart fart fart fart I don't" +
                " if this is long enough. Guess not I will add a couple more things to make it longer. Still not long enough here are a couple more useless words");

            page1.addDestination("Yes", page2);
            page1.addDestination("No", page2);
            page1.addDestination("Test 2 line option that should be really long and take up at least 2 lines?", page2);
            page1.addDestination("Exit", page3);

            page2.setText(@"Test page 2");
            page2.addDestination("Exit", page3);
            testNpc.setExitPage(page3);
            testNpc.addChatPage(page1);
            testNpc.addChatPage(page2);
            testNpc.addChatPage(page3);

            testNpc.setFirstChatPage(page1);
            testNpc.setCurrentChatPage(page1);

            npcList.Add(testNpc);
            FreeTile ft = (FreeTile) zoneTileMap.getTile(6, 3, 1);
            ft.insertNPC();
        }
Esempio n. 2
0
 public void fadeIn(NPC npc)
 {
     fadingIn = true;
     fadeCounter = 0;
     talkingNPC = npc;
     npc.getFirstChatPage().parseString();
     npc.getFirstChatPage().setOptionIndex(0);
     npc.setCurrentChatPage(npc.getFirstChatPage());
 }
Esempio n. 3
0
 public void insertNPC(NPC npc)
 {
     Vector2 global = npc.getCurrentLocation();
     fillRectangle(true, (int)global.Y, (int)global.X, npc.getHeight(), npc.getWidth());
     for (int i = (int) global.Y - npc.getYOffset(); i < npc.getHeight(); i++)
     {
         for (int j = (int)global.X; j < npc.getWidth(); j++)
         {
             insertNPCAtLocation(npc, i, j);
         }
     }
 }
Esempio n. 4
0
 private void fillLevel1TrafficMap()
 {
     NPC testNPC = new NPC("A", this, new Vector2(300, 1200), 0, new Vector2(30, 30)); // need to move creation of NPCS somewhere else
     NPC testNPC2 = new NPC("B", this, new Vector2(350, 1200), 0, new Vector2(30, 60));
     NPC testNPC3 = new NPC("C", this, new Vector2(750, 750), 0, new Vector2(60, 60));
     //testNPC.setStationaryImage(Image.FromFile("../../../Images/NPCs/TestZones/TestZone/TestNPC/StationaryImage.png"));
     //testNPC2.setStationaryImage(Image.FromFile("../../../Images/NPCs/TestZones/TestZone/TestNPC/LargeStationaryImage.png"));
     //testNPC3.setStationaryImage(Image.FromFile("../../../Images/NPCs/TestZones/TestZone/TestNPC/LargeTallStationaryImage.png"));
     //level1TrafficMap.insertNPC(testNPC, 1200, 300, 30, 30); //use npc height and width etc.
     //level1TrafficMap.insertNPC(testNPC2, 1200, 350, 30, 30);
     //level1TrafficMap.insertNPC(testNPC3, 750, 750, 30, 60);
     level1TrafficMap.insertNPC(testNPC);
     level1TrafficMap.insertNPC(testNPC2);
     level1TrafficMap.insertNPC(testNPC3);
     npcList.Add(testNPC);
     npcList.Add(testNPC2);
     npcList.Add(testNPC3);
 }
Esempio n. 5
0
 public void insertNPCAtLocation(NPC npc, int y, int x)
 {
     npcMap[y, x] = npc;
 }
Esempio n. 6
0
 public void removeNPCfromList(NPC npc)
 {
     npcList.Remove(npc);
 }
Esempio n. 7
0
 public void addNPCtoList(NPC npc)
 {
     npcList.Add(npc);
 }
Esempio n. 8
0
        private void checkForNPCs(GameInit gameInit)
        {
            int direction = gameInit.getPlayer().getFacingDirection();

            if (direction == 0)
            {
                int yLocation = (int)gameInit.getPlayer().getGlobalLocation().Y;
                int xLocation = (int)gameInit.getPlayer().getGlobalLocation().X;

                if (yLocation >= 0)
                {
                    for (int i = 0; i < gameInit.getZoneFactory().getCurrentZone().getNPCs().Count; i++)
                    {
                        NPC currentNPC = gameInit.getZoneFactory().getCurrentZone().getNPCs()[i];

                        if (currentNPC.getCurrentLevel() == gameInit.getPlayer().getCurrentZoneLevel())
                        {
                            int npcLocation = (int)currentNPC.getCurrentLocation().Y + (int)currentNPC.getSize().Y - 1;

                            if (npcLocation < yLocation && npcLocation >= yLocation - 5)
                            {
                                if (currentNPC.getCurrentLocation().X >= xLocation && currentNPC.getCurrentLocation().X < xLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                                else if (currentNPC.getCurrentLocation().X + currentNPC.getSize().X - 1 >= xLocation && currentNPC.getCurrentLocation().X + currentNPC.getSize().X - 1 < xLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                            }
                        }

                    }
                }
                if (!talkToNPC)
                {
                    currentAction = NONE;
                }
            }
            else if (direction == 1)
            {
                int yLocation = (int)gameInit.getPlayer().getGlobalLocation().Y;
                int xLocation = (int)gameInit.getPlayer().getGlobalLocation().X;

                if (yLocation < gameInit.getZoneFactory().getCurrentZone().getHeight())
                {
                    for (int i = 0; i < gameInit.getZoneFactory().getCurrentZone().getNPCs().Count; i++)
                    {
                        NPC currentNPC = gameInit.getZoneFactory().getCurrentZone().getNPCs()[i];

                        if (currentNPC.getCurrentLevel() == gameInit.getPlayer().getCurrentZoneLevel())
                        {
                            int npcLocation = (int)currentNPC.getCurrentLocation().Y;

                            if (npcLocation > yLocation + 29 && npcLocation <= yLocation + 29 + 5)
                            {
                                if (currentNPC.getCurrentLocation().X >= xLocation && currentNPC.getCurrentLocation().X < xLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                                else if (currentNPC.getCurrentLocation().X + currentNPC.getSize().X - 1 >= xLocation && currentNPC.getCurrentLocation().X + currentNPC.getSize().X - 1 < xLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                            }
                        }

                    }
                }
                if (!talkToNPC)
                {
                    currentAction = NONE;
                }
            }
            else if (direction == 2)
            {
                int yLocation = (int)gameInit.getPlayer().getGlobalLocation().Y;
                int xLocation = (int)gameInit.getPlayer().getGlobalLocation().X;

                if (xLocation < gameInit.getZoneFactory().getCurrentZone().getWidth())
                {
                    for (int i = 0; i < gameInit.getZoneFactory().getCurrentZone().getNPCs().Count; i++)
                    {
                        NPC currentNPC = gameInit.getZoneFactory().getCurrentZone().getNPCs()[i];

                        if (currentNPC.getCurrentLevel() == gameInit.getPlayer().getCurrentZoneLevel())
                        {
                            int npcLocation = (int)currentNPC.getCurrentLocation().X;

                            if (npcLocation > xLocation + 29 && npcLocation <= xLocation + 29 + 5)
                            {
                                if (currentNPC.getCurrentLocation().Y >= yLocation && currentNPC.getCurrentLocation().Y < yLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                                else if (currentNPC.getCurrentLocation().Y + currentNPC.getSize().Y - 1 >= yLocation && currentNPC.getCurrentLocation().Y + currentNPC.getSize().Y < yLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                            }
                        }

                    }
                }
                if (!talkToNPC)
                {
                    currentAction = NONE;
                }
            }
            else if (direction == 3)
            {
                int yLocation = (int)gameInit.getPlayer().getGlobalLocation().Y;
                int xLocation = (int)gameInit.getPlayer().getGlobalLocation().X;

                if (xLocation >= 0)
                {
                    for (int i = 0; i < gameInit.getZoneFactory().getCurrentZone().getNPCs().Count; i++)
                    {
                        NPC currentNPC = gameInit.getZoneFactory().getCurrentZone().getNPCs()[i];

                        if (currentNPC.getCurrentLevel() == gameInit.getPlayer().getCurrentZoneLevel())
                        {
                            int npcLocation = (int)currentNPC.getCurrentLocation().X + (int)currentNPC.getSize().X - 1;

                            if (npcLocation < xLocation && npcLocation >= xLocation - 5)
                            {
                                if (currentNPC.getCurrentLocation().Y >= yLocation && currentNPC.getCurrentLocation().Y < yLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                                else if (currentNPC.getCurrentLocation().Y + currentNPC.getSize().Y - 1 >= yLocation && currentNPC.getCurrentLocation().Y + currentNPC.getSize().Y < yLocation + 30)
                                {
                                    if (talkToNPC)
                                    {
                                    }
                                    else
                                    {
                                        currentAction = TALK;
                                        talkToNPC = true;
                                        interactingNPC = currentNPC;
                                    }
                                }
                            }
                        }
                    }
                }

                if (!talkToNPC)
                {
                    currentAction = NONE;
                }
            }
        }