void updateTearAnimation() { ++_animFrame; if (_animFrame < _tearFrames.Length) { _snagSprite = new GeneralSprite( _centerPoint, _tearSize, _tearOffset, _tearFrames[_animFrame]); //this.snagSprite.position = this.snagSprite.position.minus(new Point(1, 0)); _blinky.Position = _blinky.Position - new Vector2(1, 0); return; } _animFrame = 0; _blinky.Visible = false; setLookingBlinky(0); _lookTimer = new LoopingTimer(1500.Milliseconds(), async() => await updateBlinkyLookAnimation()); _lookingBlinky.Visible = true; _stage = Stage.BlinkyLooking; }
public BigPacChaseAct(IMediator mediator, IGameSoundPlayer gameSoundPlayer) { _mediator = mediator; _gameSoundPlayer = gameSoundPlayer; _finished = false; var justOffScreen = new Vector2(250, 140); _blinkyTimer = new EggTimer(4500.Milliseconds(), reverseChase); _pacTimer = new EggTimer(4750.Milliseconds(), () => { }); _pacMan = new AttractScenePacMan { Direction = Directions.Left }; _bigPacMan = new GeneralSprite(Vector2.Zero, new Size(31, 32), new Vector2(16, 16), new Vector2(488, 16), new Vector2(520, 16), 110.Milliseconds()) { Visible = false }; _blinky = new AttractGhost(GhostNickname.Blinky, Directions.Left); _pacPositions = new StartAndEndPos(justOffScreen, new Vector2(-70, justOffScreen.Y)); _blinkyPositions = new StartAndEndPos(justOffScreen + new Vector2(20, 0), new Vector2(-40, justOffScreen.Y)); }
public GhostTearAct(IGameSoundPlayer gameSoundPlayer, IMediator mediator) { _gameSoundPlayer = gameSoundPlayer; _mediator = mediator; _finished = false; //NextAct = nextAct; _stage = Stage.MovingBlinky; _animFrame = 0; _tearFrames = new[] { new Vector2(589, 98), new Vector2(609, 98), new Vector2(622, 98), new Vector2(636, 98), new Vector2(636, 98), new Vector2(636, 98), new Vector2(649, 98) }; _blinkyLookFrames = new[] { new Vector2(584, 113), new Vector2(600, 113) }; _blinkyTimer = new EggTimer(4500.Milliseconds(), blinkyCaught); _tearTimer = new LoopingTimer(500.Milliseconds(), () => { if (_stage == Stage.TearingBlinky) { updateTearAnimation(); } }); _lookTimer = new LoopingTimer(TimeSpan.MaxValue, () => { }); _pacTimer = new EggTimer(4750.Milliseconds(), () => { }); _pacMan = new AttractScenePacMan { Direction = Directions.Left }; _snagSprite = new GeneralSprite(_centerPoint, _tearSize, _tearOffset, _tearFrames[0]) { Visible = true }; _blinky = new AttractGhost(GhostNickname.Blinky, Directions.Left); _lookingBlinky = new NullSprite(); var justOffScreen = new Vector2(250, 140); _pacPositions = new StartAndEndPos(justOffScreen, new Vector2(-70, justOffScreen.Y)); _blinkyPositions = new StartAndEndPos(justOffScreen + new Vector2(120, 0), _centerPoint - new Vector2(10, 0)); }
public SpriteTweener( GeneralSprite sprite, Tweener tweener, Action <SpriteTweener> whenRunning, Action <SpriteTweener> whenFinished) { _sprite = sprite; _tweener = tweener; _whenRunning = whenRunning; _tweener.Ended += () => whenFinished(this); }
void setLookingBlinky(int frame) { _lookingBlinky = new GeneralSprite( _blinky.Position, _blinky.Size, _blinky.Origin, _blinkyLookFrames[frame]) { Visible = true }; }
public AttractAct( ICoinBox coinBox, IMediator mediator, IHumanInterfaceParser input, IGameSoundPlayer gameSoundPlayer) { MarqueeText[] texts = { new MarqueeText { Text = "tap or space for 1 player", YPosition = 195, TimeIdle = 1.Seconds(), TimeIn = 2.Seconds(), TimeStationary = 2.Seconds(), TimeOut = 1.Seconds() }, new MarqueeText { Text = "press or 2 for 2 players", YPosition = 195, TimeIdle = 0.Seconds(), TimeIn = 2.Seconds(), TimeStationary = 2.Seconds(), TimeOut = 1.Seconds() } }; _marquee = new Marquee(texts); _coinBox = coinBox; _mediator = mediator; _input = input; _gameSoundPlayer = gameSoundPlayer; _pacmanLogo = new GeneralSprite(new Vector2(192, 25), new Size(36, 152), Vector2.Zero, new Vector2(456, 173)); _blazorLogo = new BlazorLogo(); _instructions = new List <Instruction>(); _startTime = TimeSpan.MinValue; _blinky = new SimpleGhost(GhostNickname.Blinky, Directions.Right); _pinky = new SimpleGhost(GhostNickname.Pinky, Directions.Right); _inky = new SimpleGhost(GhostNickname.Inky, Directions.Right); _clyde = new SimpleGhost(GhostNickname.Clyde, Directions.Right); _startTime = TimeSpan.MinValue; _chaseSubActReadyAt = 9.Seconds(); _chaseSubAct = new ChaseSubAct(); _lock = new object(); }
public BlazorLogo() { _blazorLogo = new( new(90, 85), new(64, 60), Vector2.Zero, new(547, 160)); var colorTweeningFunction = Tweener.CreateTweeningFunction <Linear>(Easing.EaseNone); _colorTweener = new(.12f, .8f, 3.Seconds(), colorTweeningFunction); _colorTweener.Ended += () => { _colorTweener.Reverse(); _colorTweener.Reset(); }; }
public TornGhostChaseAct(IMediator mediator, IGameSoundPlayer gameSoundPlayer) { _mediator = mediator; _gameSoundPlayer = gameSoundPlayer; _finished = false; var justOffScreen = new Vector2(250, 140); _ghostTimer = new EggTimer(4500.Milliseconds(), reverseChase); _pacTimer = new EggTimer(4800.Milliseconds(), () => { }); _pacMan = new AttractScenePacMan { Direction = Directions.Left }; _worm = new GeneralSprite(Vector2.Zero, new Size(22, 11), new Vector2(11, 5.5f), new Vector2(594, 132), new Vector2(626, 132), 110.Milliseconds()) { Visible = false }; _blinky = new GeneralSprite(Vector2.Zero, new Size(14, 14), new Vector2(7.5f, 7.5f), new Vector2(618, 113), new Vector2(634, 113), 110.Milliseconds()); _pacPositions = new StartAndEndPos(justOffScreen, new Vector2(-70, justOffScreen.Y)); _ghostStartAndEndPos = new StartAndEndPos(justOffScreen + new Vector2(50, 0), new Vector2(-40, justOffScreen.Y)); }
public AttractAct( ICoinBox coinBox, IMediator mediator, IHumanInterfaceParser input, IGameSoundPlayer gameSoundPlayer) { string version = Assembly .GetEntryAssembly() ?.GetCustomAttribute <AssemblyInformationalVersionAttribute>() ?.InformationalVersion ?? "??"; MarqueeText[] texts = { new() { Text = $"v{version}", YPosition = 195, TimeIdle = 1.Seconds(), TimeIn = 1.Seconds(), TimeStationary = 1.Seconds(), TimeOut = .5f.Seconds() }, new() { Text = "tap/space - 1 player", YPosition = 195, TimeIdle = 1.Seconds(), TimeIn = 2.Seconds(), TimeStationary = 2.Seconds(), TimeOut = 1.Seconds() }, new() { Text = "long press/2 - 2 players", YPosition = 195, TimeIdle = 0.Seconds(), TimeIn = 2.Seconds(), TimeStationary = 2.Seconds(), TimeOut = 1.Seconds() } }; _marquee = new(texts); _coinBox = coinBox; _mediator = mediator; _input = input; _gameSoundPlayer = gameSoundPlayer; _pacmanLogo = new(new(192, 25), new(36, 152), Vector2.Zero, new(456, 173)); _blazorLogo = new(); _instructions = new(); _startTime = TimeSpan.MinValue; _blinky = new(GhostNickname.Blinky, Direction.Right); _pinky = new(GhostNickname.Pinky, Direction.Right); _inky = new(GhostNickname.Inky, Direction.Right); _clyde = new(GhostNickname.Clyde, Direction.Right); _startTime = TimeSpan.MinValue; _chaseSubActReadyAt = 9.Seconds(); _chaseSubAct = new(); _lock = new(); }