Пример #1
0
        public ControlSequence RunTwo()
        {
            var two = new ControlSequence
            {
                ButtonState.DoNothing,
                ButtonState.Start,
                ButtonState.DoNothing,
                ButtonState.Right,
                ButtonState.Right,
                ButtonState.Right,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Left,
                ButtonState.DoNothing,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.Left,
                ButtonState.LeftJump,
                ButtonState.Down,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.Right
            };

            return(two);
        }
Пример #2
0
 public void Print(ControlSequence sequence)
 {
     foreach (ButtonState item in sequence)
     {
         Console.WriteLine($"Right: {item.ButtonRightIsPressed}, Left: {item.ButtonLeftIsPressed}, Up: {item.ButtonUpIsPressed}, Down: {item.ButtonDownIsPressed}, A: {item.ButtonAIsPressed}, B: {item.ButtonBIsPressed}, Start: {item.ButtonStartIsPressed}, Select: {item.ButtonSelectIsPressed}");
     }
 }
Пример #3
0
        static void Main(string[] args)
        {
            ControlSequence mySequence = new ControlSequence();

            ControlSequence run = new ControlSequence();

            run = run.RunOne();

            var listOfRuns = new List <ControlSequence>();

            listOfRuns.Add(run);

            var player  = new GamePlayer();
            var results = player.Play(listOfRuns);

            var evaluators = new List <IAchievementEvaluator>()
            {
                new DistanceAchievementEvaluator(),
                new StepAchievementEvaluator(),
                new ScoreAchievementEvaluator(),
                new CoinAchievementEvaluator(),
            };

            Console.WriteLine("Do you want the achievements to print to screen or to text file?");
            Console.WriteLine("1) Screen");
            Console.WriteLine("2) Text");
            Console.WriteLine("Press 1 or 2");
            int userPick = Convert.ToInt32(Console.ReadLine());

            foreach (IAchievementEvaluator evaluator in evaluators)
            {
                var achievement = evaluator.GetAchievements(results);
                if (userPick == 1)
                {
                    foreach (var a in achievement)
                    {
                        Console.WriteLine(a);
                    }
                }
                else if (userPick == 2)
                {
                    using (System.IO.StreamWriter file =
                               new System.IO.StreamWriter(@"C:\Users\cheez\Desktop\Achievements.txt"))
                        foreach (var a in achievement)
                        {
                            file.WriteLine(a);
                        }
                }
                else
                {
                    Console.WriteLine("Invalid choice. Your achievements are deleted.");
                }
            }

            Console.WriteLine(results.Max(r => r.MaximumHorizontalDistance));
            Console.WriteLine(results.Max(r => r.StepWhereRunEnded));

            Console.WriteLine("Press Any Key To Continue");
            Console.ReadKey();
        }
        public ControlSequence KamikamikazeRunRight()
        {
            ControlSequence mySecondSequence = new ControlSequence();

            mySecondSequence.Add(_doNothing);
            mySecondSequence.Add(_doNothing);
            mySecondSequence.Add(_pressStart);
            mySecondSequence.Add(_doNothing);
            mySecondSequence.Add(_doNothing);
            mySecondSequence.Add(_moveRight);
            mySecondSequence.Add(_moveRight);
            mySecondSequence.Add(_moveRight);
            mySecondSequence.Add(_moveRight);
            mySecondSequence.Add(_moveRight);
            mySecondSequence.Add(_moveRight);
            mySecondSequence.Add(_moveRight);

            return(mySecondSequence);
        }
        public ControlSequence RunAndJump()
        {
            ControlSequence myFirstSequence = new ControlSequence();

            myFirstSequence.Add(_doNothing);
            myFirstSequence.Add(_doNothing);
            myFirstSequence.Add(_pressStart);
            myFirstSequence.Add(_doNothing);
            myFirstSequence.Add(_doNothing);
            myFirstSequence.Add(_moveRight);
            myFirstSequence.Add(_moveRightAndJump);
            myFirstSequence.Add(_moveRight);
            myFirstSequence.Add(_moveRightAndJump);
            myFirstSequence.Add(_moveRight);
            myFirstSequence.Add(_moveRightAndJump);
            myFirstSequence.Add(_moveRight);
            myFirstSequence.Add(_moveRightAndJump);

            return(myFirstSequence);
        }
Пример #6
0
        public ControlSequence RunOne()
        {
            var one = new ControlSequence

            {
                ButtonState.DoNothing,
                ButtonState.Start,
                ButtonState.DoNothing,
                ButtonState.Right,
                ButtonState.Right,
                ButtonState.Right,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Left,
                ButtonState.DoNothing,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Run,
                ButtonState.Jump,
                ButtonState.DoNothing,
                ButtonState.Jump,
                ButtonState.Right,
                ButtonState.DoNothing,
                ButtonState.Run,
                ButtonState.Jump,
                ButtonState.Run,
                ButtonState.Run,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.DoNothing,
                ButtonState.RightJump,
                ButtonState.LeftJump,
                ButtonState.Right,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Run,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Right,      //into hole
                ButtonState.Left,
                ButtonState.RightJump,  //out of hole
                ButtonState.Right,
                ButtonState.RightJump,
                ButtonState.RightJump,
                ButtonState.RightJump,
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Run,
                ButtonState.Jump,
                ButtonState.Left,
                ButtonState.LeftJump, //back to Start of stairs
                ButtonState.Right,
                ButtonState.Jump,
                ButtonState.Run,
                ButtonState.Jump     //top of dumb stairs
            };

            return(one);
        }