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)); }
void reverseChase() { _blinkyTimer = new EggTimer(4600.Milliseconds(), () => { }); _pacTimer = new EggTimer(4350.Milliseconds(), async() => { _finished = true; await _mediator.Publish(new CutSceneFinishedEvent()); }); _pacMan.Visible = false; _bigPacMan.Visible = true; var s = new LevelStats(0); var sess = new GhostFrightSession(s.GetLevelProps()); _blinky.Direction = new DirectionInfo(Directions.Right, Directions.Right); _blinky.SetFrightSession(sess); _blinky.SetFrightened(); _blinkyPositions = _blinkyPositions.Reverse(); var bigPacPos = _pacPositions.Reverse(); bigPacPos = new StartAndEndPos(bigPacPos.Start - new Vector2(100, 0), bigPacPos.End); _pacPositions = bigPacPos; }
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)); }
void reverseChase() { _ghostTimer = new(4600.Milliseconds(), async() => { _finished = true; await _mediator.Publish(new CutSceneFinishedEvent()); }); _pacMan.Visible = false; _blinky.Visible = false; _worm.Visible = true; _ghostStartAndEndPos = _ghostStartAndEndPos.Reverse(); }
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)); }
ValueTask reverseChase() { _powerPillToEat.Visible = false; _ghostTimer = new EggTimer(12.Seconds(), () => { }); _pacTimer = new EggTimer(6.Seconds(), () => { }); var levelStats = new LevelStats(0); var frightSessions = new GhostFrightSession(levelStats.GetLevelProps()); foreach (var eachGhost in _ghosts) { eachGhost.Direction.Update(Directions.Right); eachGhost.SetFrightSession(frightSessions); eachGhost.SetFrightened(); _ghostPositions[eachGhost.NickName] = _ghostPositions[eachGhost.NickName].Reverse(); } _pacPositions = _pacPositions.Reverse(); _pacMan.Direction = Directions.Right; return(default);
public ChaseSubAct() { _finished = false; _tempTimers = new TimerList(); _ghostScore = 200; _tempSprites = new TimedSpriteList(); _ghosts = new List <AttractGhost>(); var justOffScreen = new Vector2(250, 140); _ghostEatenTimer = new EggTimer(0.Milliseconds(), () => { }); _ghostTimer = new EggTimer(5.Seconds(), async() => await reverseChase()); _pacTimer = new EggTimer(5.1f.Seconds(), () => { }); _powerPillToEat = new PowerPill { Visible = false, Position = new Vector2(30, justOffScreen.Y - 4) }; _pillLegend = new Pill { Position = new Vector2(70, 178) }; _powerPillLegend = new PowerPill { Position = new Vector2(66, 182) }; _pacMan = new AttractScenePacMan { Direction = Directions.Left }; var blinky = new AttractGhost(GhostNickname.Blinky, Directions.Left); var pinky = new AttractGhost(GhostNickname.Pinky, Directions.Left); var inky = new AttractGhost(GhostNickname.Inky, Directions.Left); var clyde = new AttractGhost(GhostNickname.Clyde, Directions.Left); _ghosts.Add(blinky); _ghosts.Add(pinky); _ghosts.Add(inky); _ghosts.Add(clyde); var gap = new Vector2(16, 0); _pacPositions = new StartAndEndPos(justOffScreen, new Vector2(30, justOffScreen.Y)); _pacMan.Position = _pacPositions.Start; _ghostPositions = new Dictionary <GhostNickname, StartAndEndPos>(); var startPos = justOffScreen + new Vector2(50, 0); var endPos = new Vector2(50, justOffScreen.Y); blinky.Position = startPos; _ghostPositions[blinky.NickName] = new StartAndEndPos(startPos, endPos); startPos = startPos + gap; endPos = endPos + gap; pinky.Position = startPos; _ghostPositions[pinky.NickName] = new StartAndEndPos(startPos, endPos); startPos = startPos + gap; endPos = endPos + gap; inky.Position = startPos; _ghostPositions[inky.NickName] = new StartAndEndPos(startPos, endPos); startPos = startPos + gap; endPos = endPos + gap; clyde.Position = startPos; _ghostPositions[clyde.NickName] = new StartAndEndPos(startPos, endPos); _tempTimers.Add(new EggTimer(1.Seconds(), () => _legendVisible = true)); _tempTimers.Add(new EggTimer(3.Seconds(), () => { _powerPillToEat.Visible = true; _copyrightVisible = true; })); _tempTimers.Add(new EggTimer(4500.Milliseconds(), () => { _ghostsChasing = true; })); }
void lerpGhost(AttractGhost ghost) { StartAndEndPos positions = _ghostPositions[ghost.NickName]; ghost.Position = Vector2s.Lerp(positions.Start, positions.End, _ghostTimer.Progress); }