public BouncingLogoWithGravity(Content content, Randomizer random, InputCommands inputCommands)
     : base(content, random)
 {
     inputCommands.Add(Key.Space, () => Reset(random));
     inputCommands.Add(MouseButton.Left, mouse => Reset(random));
     inputCommands.Add((Touch touch) => Reset(random));
 }
Ejemplo n.º 2
0
 internal void Run(InputCommands inputCommands)
 {
     var triggersCopy = new List<Trigger>(attachedTriggers);
     foreach (Trigger trigger in triggersCopy)
         if (trigger.ConditionMatched(inputCommands))
             Invoke(trigger);
 }
Ejemplo n.º 3
0
 public Ball(Paddle paddle, Content content, InputCommands inputCommands)
     : base(content.Load<Image>("Ball"), Rectangle.Zero)
 {
     this.paddle = paddle;
     UpdateOnPaddle();
     fireBallSound = content.Load<Sound>("PaddleBallStart");
     collisionSound = content.Load<Sound>("BallCollision");
     RegisterFireBallCommand(inputCommands);
 }
Ejemplo n.º 4
0
 public UI(ItemHandler items, Score score, Content content, Renderer renderer, Window window,
     InputCommands inputCommands)
     : base(content.Load<Image>("GrassBackground"), renderer.Screen.Viewport)
 {
     window.ShowCursor = false;
     window.Title = "Game Of Death - Kill rabbits before they occupy more than 75% of the world!";
     inputCommands.Add(Key.Escape, window.Dispose);
     RenderLayer = MinRenderLayer;
     AddUITop(content, renderer);
     AddUIBottom(content, renderer);
     AddUILeft(content, renderer);
     AddUIRight(content, renderer);
     renderer.Screen.ViewportSizeChanged += () => Update(renderer);
 }
Ejemplo n.º 5
0
 private void RegisterInputCommands(InputCommands inputCommands, Time time)
 {
     inputCommands.Add(Key.CursorLeft, State.Pressed,
         () => xPosition -= PaddleMovementSpeed * time.CurrentDelta);
     inputCommands.Add(Key.CursorRight, State.Pressed,
         () => xPosition += PaddleMovementSpeed * time.CurrentDelta);
     inputCommands.Add(MouseButton.Left, State.Pressed,
         mouse => xPosition += mouse.Position.X - Position.X);
     inputCommands.Add(State.Pressed, touch => xPosition += touch.GetPosition(0).X - Position.X);
     inputCommands.Add(GamePadButton.Left, State.Pressed,
         () => xPosition -= PaddleMovementSpeed * time.CurrentDelta);
     inputCommands.Add(GamePadButton.Right, State.Pressed,
         () => xPosition += PaddleMovementSpeed * time.CurrentDelta);
 }
Ejemplo n.º 6
0
 public ItemHandler(Game game, Score score, Content content, InputCommands inputCommands,
     Renderer renderer)
 {
     this.game = game;
     this.score = score;
     this.renderer = renderer;
     CreateItems(content);
     CreateIcons(content);
     SelectItem(0);
     inputCommands.AddMouseMovement(mouse => CurrentItem.UpdatePosition(mouse.Position));
     inputCommands.Add(MouseButton.Left, State.Pressing,
         mouse => SelectIconOrHandleItemInGame(mouse.Position));
     inputCommands.Add(touch => SelectIconOrHandleItemInGame(touch.GetPosition(0)));
 }
Ejemplo n.º 7
0
 public Paddle(Content content, InputCommands inputCommands, Time time)
     : base(content.Load<Image>("Paddle"), Rectangle.FromCenter(Point.Half, Size.Zero))
 {
     RegisterInputCommands(inputCommands, time);
 }
Ejemplo n.º 8
0
 private void RegisterFireBallCommand(InputCommands inputCommands)
 {
     inputCommands.Add(Key.Space, State.Pressing, () => FireBallFromPaddle());
     inputCommands.Add(MouseButton.Left, State.Pressing, mouse => FireBallFromPaddle());
     inputCommands.Add((Touch touch) => FireBallFromPaddle());
     inputCommands.Add(GamePadButton.A, State.Pressing, () => FireBallFromPaddle());
 }
Ejemplo n.º 9
0
 public BallInLevel(Paddle paddle, Content content, InputCommands inputCommands, Level level)
     : base(paddle, content, inputCommands)
 {
     Level = level;
 }
Ejemplo n.º 10
0
 public BallWithGravity(Paddle paddle, Content content, InputCommands inputCommands, Level level)
     : base(paddle, content, inputCommands, level)
 {
 }
Ejemplo n.º 11
0
 public Paddle(Content content, InputCommands inputCommands, Time time)
     : base(content.Load<Image>("Paddle"), Rectangle.One)
 {
     RegisterInputCommands(inputCommands, time);
 }
Ejemplo n.º 12
0
 public TestBall(Paddle paddle, Content content, InputCommands inputCommands)
     : base(paddle, content, inputCommands)
 {
 }