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)); }
internal void Run(InputCommands inputCommands) { var triggersCopy = new List<Trigger>(attachedTriggers); foreach (Trigger trigger in triggersCopy) if (trigger.ConditionMatched(inputCommands)) Invoke(trigger); }
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); }
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); }
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); }
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))); }
public Paddle(Content content, InputCommands inputCommands, Time time) : base(content.Load<Image>("Paddle"), Rectangle.FromCenter(Point.Half, Size.Zero)) { RegisterInputCommands(inputCommands, time); }
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()); }
public BallInLevel(Paddle paddle, Content content, InputCommands inputCommands, Level level) : base(paddle, content, inputCommands) { Level = level; }
public BallWithGravity(Paddle paddle, Content content, InputCommands inputCommands, Level level) : base(paddle, content, inputCommands, level) { }
public Paddle(Content content, InputCommands inputCommands, Time time) : base(content.Load<Image>("Paddle"), Rectangle.One) { RegisterInputCommands(inputCommands, time); }
public TestBall(Paddle paddle, Content content, InputCommands inputCommands) : base(paddle, content, inputCommands) { }