Esempio n. 1
0
        static void Main(string[] args)
        {
            Action action;

            // change encoding console(for people who have english version Windows)
            Console.OutputEncoding = Encoding.UTF8;
            // Story Characters
            var storyManager = new StoryManager();
            var oldMan       = new OldMan();
            var bear         = new Bear();

            ICollection <StoryObject> animals = new List <StoryObject>()
            {
                new Mouse(), new Frog(), new Bunny(), new Wolf()
            };

            // Story
            action = storyManager.DoRepitableAct;
            try
            {
                storyManager.DoActionZero();
                storyManager.DoActionOne(oldMan);
                foreach (StoryObject animal in animals)
                {
                    action(animal);
                }
                storyManager.FinalAction(bear);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.GetType());
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
Esempio n. 2
0
        // Bear come to gloves
        public void FinalAction(Bear bear)
        {
            // random choise
            bool _bearChois = Convert.ToBoolean(random.Next(0, 2));

            Console.WriteLine($"Вот {bear.HowMove} {bear.Name}. Увидела оъект типа {_mainVictim.Name} и такая(ой):");
            bear.Choise = _bearChois;
            if (_bearChois)
            {
                bear.Action(_mainVictim);
                _mainVictim.Objects.Add(bear);
            }
            else
            {
                bear.Action(_mainVictim);
            }
            _mainVictim.DoPlotTwist();
        }
Esempio n. 3
0
        public void Say()
        {
            Fox  fox  = new Fox();
            Hare hare = new Hare();
            int  i    = 0;

            GetRandomValues(out string foxActingOfHut, fox);
            BeginStory(foxActingOfHut);
            fox.GetSatietyOfFox();

            do
            {
                int animalNameWhichSpeakWithHare = random.GenerateRandom(4);
                fox.state = (State)random.GenerateRandom(3);
                Story deleg;
                i++;
                if (animalNameWhichSpeakWithHare == (int)Name.wolf)
                {
                    Wolf wolf = new Wolf();
                    deleg = wolf.SpeakWithHare;
                }
                else if (animalNameWhichSpeakWithHare == (int)Name.bear)
                {
                    Bear bear = new Bear();
                    deleg = bear.SpeakWithHare;
                }
                else
                {
                    C**k c**k = new C**k();
                    deleg = c**k.SpeakWithHare;
                }
                deleg(hare, foxActingOfHut, fox);
            } while (fox.state != State.fright);

            TheEndStory();
        }