private void DrawGhostAfter(int fromTick, GhostColour colour, int y, TextColour textColour, string text1, string text2) { if (_attractTick >= fromTick) { _display.AddSprite(_spriteSet.Ghost(colour, Direction.Right, false), new Location(4.5m, y)); } ShowText(fromTick + 60, text1, textColour, 7, y); ShowText(fromTick + 90, text2, textColour, 18, y); }
public Ghost(GhostColour colour, Location location, Direction direction, Location scatterTarget, Location homeLocation, bool startInHouse) { Colour = colour; Location = location; NextDirection = direction; ScatterTarget = scatterTarget; Animation = new Animation(2, 10); FlashAnimation = new Animation(2, 14, true); FlashAnimation.Stop(); State = startInHouse ? GhostState.InHouse : GhostState.Alive; HomeLocation = homeLocation; NextTarget = Location.Cell; ChangeDirection(); NextTarget = Location.Cell.Move(CurrentDirection); SkipTickEvery = 16; SpeedCounter = new SpeedCounter(); }
private int CounterStart(GhostColour colour) { if (colour == GhostColour.Red) { return(0); } if (colour == GhostColour.Pink) { return(0); } if (colour == GhostColour.Cyan) { return(_level == 0 ? 30 : 0); } return(_level switch { 0 => 60, 1 => 50, _ => 0 });
public Ghost(GhostColour colour, Location location, Direction direction) : this(colour, location, direction, new Location(0, 0), new Location(0, 0), false) { }
/// <summary> /// Get source of ghost sprite /// </summary> /// <param name="ghostColour"></param> /// <param name="direction"></param> /// <param name="animated"></param> /// <returns></returns> public SpriteSource Ghost(GhostColour ghostColour, Direction direction, bool animated) { int xpos; int ypos; switch (ghostColour) { case GhostColour.Red: xpos = 0; ypos = 14; break; case GhostColour.Cyan: xpos = 16; ypos = 18; break; case GhostColour.Pink: xpos = 0; ypos = 20; break; case GhostColour.Orange: xpos = 16; ypos = 20; break; case GhostColour.Eyes: xpos = 0; ypos = 22; break; case GhostColour.BlueFlash: xpos = 24; ypos = 12; break; case GhostColour.WhiteFlash: xpos = 28; ypos = 12; break; default: throw new Exception("GhostColour?"); } xpos += direction switch { Direction.Up => 12, Direction.Down => 4, Direction.Left => 8, Direction.Right => 0, _ => throw new Exception("Direction?") }; if (animated) { xpos += 2; } return(new SpriteSource(xpos, ypos, 2)); }
/// <summary> /// Get source of ghost sprite /// </summary> /// <param name="ghostColour"></param> /// <param name="direction"></param> /// <param name="animated"></param> /// <returns></returns> public SpriteSource Ghost(GhostColour ghostColour, Direction direction, bool animated) { int xpos; int ypos; switch (ghostColour) { case GhostColour.Red: xpos = 0; ypos = 14; break; case GhostColour.Cyan: xpos = 16; ypos = 18; break; case GhostColour.Pink: xpos = 0; ypos = 20; break; case GhostColour.Orange: xpos = 16; ypos = 20; break; case GhostColour.Eyes: xpos = 0; ypos = 22; break; case GhostColour.BlueFlash: xpos = 24; ypos = 12; break; case GhostColour.WhiteFlash: xpos = 28; ypos = 12; break; default: throw new Exception("GhostColour?"); } if (ghostColour != GhostColour.BlueFlash && ghostColour != GhostColour.WhiteFlash) { switch (direction) { case Direction.Up: xpos += 12; break; case Direction.Down: xpos += 4; break; case Direction.Left: xpos += 8; break; case Direction.Right: break; default: throw new Exception("Direction?"); } } if (animated) { xpos += 2; } return(new SpriteSource(xpos, ypos, 2)); }