public void OnPlayerTalkTo()
 {
     if (CurrentNpc != null && CurrentNpc is ISpeak)
     {
         ISpeak speakingNpc = CurrentNpc as ISpeak;
         CurrentLocationInformation = speakingNpc.Speak();
     }
 }
Пример #2
0
 public void OnShrineTalkTo()
 {
     if (CurrentShrine != null && CurrentShrine is ISpeak)
     {
         ISpeak speakingShrine = CurrentShrine as ISpeak;
         CurrentLocationInformation = speakingShrine.Speak();
     }
 }
Пример #3
0
 public void OnPlayerTalkTo()
 {
     if (CurrentNPC != null && CurrentNPC is ISpeak)
     {
         ISpeak speakingNPC = CurrentNPC as ISpeak;
         CurrentLocationInformation = speakingNPC.Speak();
     }
 }
Пример #4
0
        // Fliters through every item in the current stage. If they are within reach sorts them into list by priority.
        void SearchPlayerArea()
        {
            List <Lootable> lootList = new List <Lootable>();
            List <Door>     doorList = new List <Door>();
            List <NPC>      npcList  = new List <NPC>();

            foreach (Object item in Area.maps[player.Stage][player.StageDepth].Objects)
            {
                if (item.Location[0] <= player.Height + player.Location[0] && item.Location[0] + item.Height >= player.Location[0] &&
                    item.Location[1] <= player.Width + player.Location[1] && item.Location[1] + item.Width >= player.Location[1] + 4)
                {
                    if (item is Lootable)
                    {
                        lootList.Add(item as Lootable);
                    }
                    else if (item is Door)
                    {
                        doorList.Add(item as Door);
                    }
                    else if (item is NPC)
                    {
                        npcList.Add(item as NPC);
                    }
                }
            }
            if (lootList.Count() > 0)
            {
                PickupItem(lootList[0]);
            }
            else if (npcList.Count() > 0)
            {
                if (npcList[0] is ISpeak)
                {
                    player.Experience    += npcList[0].Experience;
                    npcList[0].Experience = 0;
                    UpdatePlayerLevel();
                    ISpeak speak = npcList[0] as ISpeak;
                    scene.DisplayText(npcList[0].Name, speak.Speak());
                    if (npcList[0].Gift != null)
                    {
                        scene.DisplayText("Item Get", npcList[0].Gift.Name + " was added to your inventory!");
                        player.Experience         += npcList[0].Gift.Experience;
                        npcList[0].Gift.Experience = 0;
                        UpdatePlayerLevel();
                        player.Inventory.Add(npcList[0].Gift);
                        npcList[0].Gift = null;
                    }
                }
                else
                {
                    scene.DisplayText(npcList[0].Name, npcList[0].Dialogue);
                }
            }
            else if (doorList.Count() > 0)
            {
                doorList[0].Open(player, this);
            }
        }
    static void Main(string[] args)
    {
        Person person = new Person();
        IWalk  walk   = person;
        ISpeak speak  = person;

        speak.sayHello();
        walk.walkForward();
    }
Пример #6
0
 public void OnPlayerTalkTo()
 {
     if (CurrentNpc != null && CurrentNpc is ISpeak)
     {
         ISpeak speakingNpc = CurrentNpc as ISpeak;
         string message     = speakingNpc.Speak();
         _messages.Add(message);
     }
 }
Пример #7
0
        public void DisplayTalkToEnemy(Enemy enemy)
        {
            ISpeak speakingEnemy = enemy as ISpeak;
            string message       = speakingEnemy.Speak();

            IBattle battlingEnemy = enemy as IBattle;
            string  attackMessage = battlingEnemy.AttackMessage;

            DisplayGamePlayScreen("Speak to Character", message + "\n " + attackMessage, ActionMenu.AttackMenu, "");
        }
Пример #8
0
 public void OnPlayerTalkTo()
 {
     if (CurrentNPC != null && CurrentNPC is ISpeak)
     {
         ISpeak speakingNPC = CurrentNPC as ISpeak;
         CurrentLocationInformation = speakingNPC.Speak();
         _player.NPCsEngaged.Add(_currentNPC);
         _player.UpdateMissionStatus();
     }
 }
Пример #9
0
 public void OnPlayerTalkTo()
 {
     if (CurrentNpc != null && CurrentNpc is ISpeak)
     {
         ISpeak speakingNpc = CurrentNpc as ISpeak;
         CurrentLocationInformation = speakingNpc.Speak();
         _player.NpcsEngaged.Add(_currentNpc);
         _player.UpdateMissionStatus();
     }
 }
Пример #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Animal[] animals = new Animal[5];
            ISpeak[] Speaker = new ISpeak[4];

            Manticore ElPapi = new Manticore {
                Name = "ElPapi", Diet = "Blood and Bones", Lift = (1000 * 32.17), Intro = "I am ElPapi"
            };
            Mermaid KanyeBass = new Mermaid {
                Name = "KanyeBass", Diet = "FishSticks", IsIntelligent = false, Intro = "I love FishSticks"
            };
            Eagle Freedom = new Eagle {
                Name = "Freedom", HasFins = false, NumWings = 50, Lift = 1817, Diet = "Worms"
            };
            Rhino Rocksteady = new Rhino {
                Name = "Rocksteady", NumOfLegs = 4, Diet = "Meat and more meat", Intro = "I'm gonna crush those pesky ninja turtles"
            };
            Dragon Oenomaus = new Dragon {
                Name = "Oenomaus", IsIntelligent = true, Intro = "Im a DAWG BOWWWWWWW", Diet = "All meat baby", HasTeeth = true
            };

            Speaker[0] = ElPapi;
            Speaker[1] = KanyeBass;
            Speaker[2] = Rocksteady;
            Speaker[3] = Oenomaus;

            animals[0] = ElPapi;
            animals[1] = KanyeBass;
            animals[2] = Freedom;
            animals[3] = Rocksteady;
            animals[4] = Oenomaus;

            for (int i = 0; i < Speaker.Length; i++)
            {
                var speakers = Speaker[i];

                if (speakers is HasWings)
                {
                    var speakingWings = (HasWings)speakers;
                    speakingWings.ImFlying();
                }
                else if (speakers is NoWings)
                {
                    var grounded = (NoWings)speakers;
                    grounded.GroundBB();
                }
            }
            for (int i = 0; i < animals.Length; i++)
            {
                Console.WriteLine($"My name is {animals[i].Name} and I like to eat {animals[i].Diet}");
            }
        }
Пример #11
0
        static void Main(string[] args)
        {
            Cat              cat          = new Cat();
            Trump            trump        = new Trump();
            GorillaWithDowns gwd          = new GorillaWithDowns();
            var              phrases      = new Phrase();
            var              catPhrases   = new List <string>();
            var              gwdPhrases   = new List <string>();
            var              trumpPhrases = new List <string>();


            string bannana     = "Can I have a bannana?";
            string child       = "Please drop your child in my cage";
            string canHazTrump = "I can haz babY tRumP?!";

            string racist   = "I am a stupid racist";
            string tradeWar = "Trade wars are easy to win";
            string dictator = "Maybe I just wont leave";


            string meow = "MeowMeowMeow";
            string purr = "Purrrrr";
            string hiss = "Hiss";


            gwdPhrases.Add(bannana);
            gwdPhrases.Add(child);
            gwdPhrases.Add(canHazTrump);


            trumpPhrases.Add(racist);
            trumpPhrases.Add(tradeWar);
            trumpPhrases.Add(dictator);


            catPhrases.Add(meow);
            catPhrases.Add(purr);
            catPhrases.Add(hiss);



            ISpeak[] speakers = new ISpeak[3];
            speakers[0] = cat;
            speakers[1] = gwd;
            speakers[2] = trump;


            cat.SaySomething(catPhrases);

            trump.SaySomething(trumpPhrases);

            gwd.SaySomething(gwdPhrases);
        }
Пример #12
0
    void Act(GameObject animal)
    {
        switch (input)
        {
        case InputType.LMB:
        {
            ISpeak speak = animal.GetComponent <ISpeak>();
            if (speak != null)
            {
                speak.Speak();
                speakCount++;
            }
            break;
        }

        case InputType.RMB:
        {
            IWalk walk = animal.GetComponent <IWalk>();
            if (walk != null)
            {
                walk.Walk();
                walkCount++;
            }
            break;
        }

        case InputType.Space:
        {
            ISwim swim = animal.GetComponent <ISwim>();
            if (swim != null)
            {
                swim.Swim();
                swimCount++;
            }
            break;
        }

        case InputType.I:
        {
            IID id = animal.GetComponent <IID>();

            if (id != null)
            {
                id.Identify();
            }

            break;
        }

        default: break;
        }
    }
Пример #13
0
        /// <summary>
        /// display the message from the NPC
        /// </summary>
        /// <param name="npc">speaking NPC</param>
        public void DisplayTalkTo(Npc npc)
        {
            ISpeak speakingNpc = npc as ISpeak;

            string message = speakingNpc.Speak();

            if (message == "")
            {
                message = "It appears this character has nothing to say. Please try again.";
            }

            DisplayGamePlayScreen("Speak to Character", message, ActionMenu.NpcMenu, "");
        }
Пример #14
0
        /// <summary>
        /// display NPC dialog
        /// </summary>
        /// <param name="npc"></param>
        public void DisplayTalkTo(NPC npc)
        {
            ISpeak  speakingNpc  = npc as ISpeak;
            IModify modifyingNpc = npc as IModify;

            string message = speakingNpc.Speak();

            if (message == "")
            {
                message = "It appears this character has nothing to say.  Please try agian.";
            }

            DisplayGamePlayScreen("Speak to Character", message, ActionMenu.NpcMenu, "");

            _gamePlayer.Health += modifyingNpc.HealthModifier;
        }
Пример #15
0
        private void TalkToAction()
        {
            ActionMenu.currentMenu = ActionMenu.CurrentMenu.InteractMenu;

            int Id = _gameConsoleView.DisplayGetGameNPCId(_universe.GameNPCs.Where(b => b.LocationID == _gamePlayer.LocationID), ActionMenu.InteractMenu);

            if (Id > 0)
            {
                ISpeak gameNPC = _universe.GameNPCs.Where(b => b.CharID == Id).First() as ISpeak;
                _gameConsoleView.DisplayGamePlayScreen("Talk To", gameNPC.Speak(), ActionMenu.InteractMenu, "");
            }
            else if (Id == 0) //cancelled selection
            {
                _gameConsoleView.DisplayGamePlayScreen("Interact With", Text.InteractWith(), ActionMenu.InteractMenu, "", _gameMap.GetAvailableMovement(_gamePlayer.LocationID));
            }
        }
Пример #16
0
        public void DisplayTalkTo(NPC npc)
        {
            ISpeak speakingNpc = npc as ISpeak;

            string message = npc.Name + ": \"" + speakingNpc.Speak() + "\"";

            //if (message == "")
            //{
            //    message = "You approach the survivor, but they have nothing to say...";
            //}

            // TODO
            DisplayGamePlayScreen("Speak to Character", message, ActionMenu.NpcMenu, "");
            DisplayMessage("Press any key to continue...");
            Console.ReadKey();
        }
Пример #17
0
        public void OnPlayerTalkTo()
        {
            if (CurrentNpc != null && CurrentNpc is ISpeak)
            {
                ISpeak speakingNpc = CurrentNpc as ISpeak;
                CurrentLocationInformation = speakingNpc.Speak();
                Player.NpcsEngaged.Add(CurrentNpc);
                Player.UpdateMissionStatus();
                if (CurrentNpc.Inventory != null)
                {
                    switch (CurrentNpc.Id)
                    {
                    case 1003:
                    case 1008:
                        if (CurrentNpc.Inventory.Count != 0)
                        {
                            GameItem gameItem = CurrentNpc.Inventory[0];
                            CurrentLocation.AddGameItemToLocation(gameItem);
                            CurrentNpc.RemoveGameItemFromNpc(gameItem);
                        }
                        break;

                    case 1004:
                        if (CurrentNpc.Inventory.Count != 0)
                        {
                            GameItem currentItem = CurrentNpc.Inventory[0];
                            if (currentItem.Id == 2003)
                            {
                                CurrentLocation.AddGameItemToLocation(currentItem);
                                CurrentNpc.RemoveGameItemFromNpc(currentItem);
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            else
            {
                CurrentLocationInformation = "Beasts can not speak!";
            }
        }
Пример #18
0
        /// <summary>
        /// Talk to Screen for NPCs
        /// </summary>
        /// <param name="npc"></param>
        /// <param name="_illusion"></param>
        public void DisplayTalkTo(Npc npc, Sound _illusion)
        {
            if (npc.Name == "Black Cat")
            {
                _illusion.playSound(false);
            }

            //Allow the NPC to access speak functionality
            ISpeak speakingNpc = npc as ISpeak;

            string message = speakingNpc.Speak();

            if (message == "")
            {
                message = "This character has nothing to say.";
            }

            DisplayGamePlayScreen("Speak to NPC", message, ActionMenu.NpcMenu, "");
        }
Пример #19
0
        static void TestOutInterfaces()
        {
            // This exhibits polymorphism because
            // we are able to group together types
            ISpeak[] speaks = new ISpeak[2];

            ISpeak speak = new Smurf();

            // unicorn implements ispeak...so we can use it
            Unicorn uni = new Unicorn();

            uni.Color = "pink";
            uni.Name  = "Magical Unicorn";
            uni.CreateCutieMark();

            Smurf smurf = new Smurf();

            smurf.Name = "Smurfy";

            speaks[0] = uni;
            speaks[1] = smurf;

            for (int i = 0; i < speaks.Length; i++)
            {
                speaks[i].SayHello();
            }

            MagicalCreature[] mc = new MagicalCreature[2];

            Dragon dragon = new Dragon();

            mc[0] = uni;
            mc[1] = dragon;

            for (int i = 0; i < mc.Length; i++)
            {
                if (mc[i] is ISpeak)
                {
                    // put that obj in another array
                    // save it into the db
                }
            }
        }
Пример #20
0
        public void OnPlayerTalk()
        {
            if (CurrentNPC != null && CurrentNPC is ISpeak)
            {
                ISpeak speakingNPC = CurrentNPC as ISpeak;
                CurrentLocationInformation = speakingNPC.Speak();
                _player.UpdateMissionStatus();
                _player.NPCSDefeated.Remove(_currentNPC);

                //
                // Ask If they want to accept the quest, then add quest if yes
                //
                //if (CurrentNPC.Name == "Emperor Palpatine")
                //{
                //    if (MessageBox.Show("Do you want to accept the quests?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                //    {

                //    }
                //    else
                //    {
                //        // Do Nothing
                //    }
                //}
                //else if (CurrentNPC.Name == "Obi-Wan Kenobi")
                //{
                //    if (MessageBox.Show("Do you want to accept the quests?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                //    {

                //    }
                //    else
                //    {
                //        // Do Nothing
                //    }
                //}
            }
        }
Пример #21
0
        static void Main(string[] args)
        {
            Human   human   = new Human();
            Student student = new Student();
            Robot   robot   = new Robot();

            Car     car     = new Car();
            Bicycle bicycle = new Bicycle();
            // ------------------------------------------------------------
            // Using objects as interfaces
            // ------------------------------------------------------------
            IDrive iDrive = student;

            iDrive.Drive(car);
            iDrive.Drive(bicycle);
            // Vinicio - now change this to a robot
            // ------------------------------------------------------------
            ISpeak[] interfaceArray = new ISpeak[3];
            interfaceArray[0] = human;
            interfaceArray[1] = student;
            interfaceArray[2] = robot;

            Conference(interfaceArray);
        }
Пример #22
0
 public string GetSpeech(int id, [Inject] ISpeak speaker)
 {
     return(speaker.Speak());
 }
Пример #23
0
 public bool Method1(int id, [Inject] ISpeak speaker)
 {
     return(speaker == null);
 }
 public Bird(IFly flyBehaviour, ISpeak speakBehaviour, ISwim swimBehaviour)
 {
     FlyBehaviour = flyBehaviour;
     SpeakBehaviour = speakBehaviour;
     SwimBehaviour = swimBehaviour;
 }
Пример #25
0
 public Cow(ISpeak speak)
 {
     this.speak = speak;             //saves parameter into property
 }
Пример #26
0
 static void PublicSpeaking(ISpeak speaker)
 {
     speaker.SayHello();
 }
Пример #27
0
 public Cot(ISpeak speak)
 {
     this.speak = speak;
 }
        static void Main(string[] args)
        {
            //dog exercise
            ISpeak dog1 = Factory.getDog("small");

            dog1.Speak();

            ISpeak dog2 = Factory.getDog("big");

            dog2.Speak();

            ISpeak dog3 = Factory.getDog("working");

            dog3.Speak();

            //library exercise
            Book book1 = new Book();

            book1.Title       = "Blindness";
            book1.Author      = "Mari Maasikas";
            book1.ReleaseYear = 2000;
            book1.Genre       = BookGenre.ScienceFiction;

            Book book2 = new Book();

            book2.Title       = "Magic mountain";
            book2.Author      = "Juku Kalle";
            book2.ReleaseYear = 2002;
            book2.Genre       = BookGenre.ScienceFiction;

            Book book3 = new Book();

            book3.Title       = "Magic";
            book3.Author      = "Kusti Kuusk";
            book3.ReleaseYear = 2010;
            book3.Genre       = BookGenre.Drama;

            Book book4 = new Book();

            book4.Title       = "Magic";
            book4.Author      = "Kusti Kuusk";
            book4.ReleaseYear = 2010;
            book4.Genre       = BookGenre.Drama;

            Book book5 = new Book();

            book5.Title       = "Cakes - Recipes";
            book5.Author      = "Jane Smith";
            book5.ReleaseYear = 2010;
            book5.Genre       = BookGenre.Cookbook;

            Book book6 = new Book();

            book6.Title       = "Owls";
            book6.Author      = "Oru Ott";
            book6.ReleaseYear = 1995;
            book6.Genre       = BookGenre.Horror;

            Book book7 = new Book();

            book7.Title       = "Love";
            book7.Author      = "Oru Ott";
            book7.ReleaseYear = 1985;
            book7.Genre       = BookGenre.Romance;

            Book book8 = new Book();

            book8.Title       = "10 dinner ideas - Recipes";
            book8.Author      = "Gordon Ramsay";
            book8.ReleaseYear = 2012;
            book8.Genre       = BookGenre.Cookbook;

            Book book9 = new Book();

            book9.Title       = "Space Wars";
            book9.Author      = "Tim Wott";
            book9.ReleaseYear = 1830;
            book9.Genre       = BookGenre.ScienceFiction;

            Book book10 = new Book();

            book10.Title       = "Last Spring";
            book10.Author      = "Anna Spruce";
            book10.ReleaseYear = 1989;
            book10.Genre       = BookGenre.Romance;

            book3.CompareBooks(book4);
            Library library = new Library("School library");

            library.LibraryAddress = "Tammsaare 2";

            library.AddBook(book1);
            library.AddBook(book2);
            library.AddBook(book3);
            library.AddBook(book4);
            library.AddBook(book5);
            library.AddBook(book6);
            library.AddBook(book7);
            library.AddBook(book8);
            library.AddBook(book9);
            library.AddBook(book10);

            List <Book> allBooksThatContainDarkness = library.FindAllBooksByName("Magic");

            library.PrintAllBooksByName("Magic");



            bool canBorrow      = library.BorrowBook("Darkness 2");
            bool canBorrowAgain = library.BorrowBook("Sci-fi");

            //Info printimine
            library.PrintAllBookTitlesInLibrary();
            library.PrintLibraryInfo();
            book1.PrintBookInfo();
            library.PrintAllBooksByAuthor("Mari Maasikas");
            library.PrintAllBooksByAuthor("Oru Ott");

            Console.ReadLine();
        }
Пример #29
0
 public CatCow(ISpeak speak)
 {
     this.speak = speak;
 }
Пример #30
0
 public void SetSpeaker(ISpeak speak)
 {
     _speak = speak;
 }
Пример #31
0
 public David(ISpeak speak)
 {
     this.speak = speak;
 }