public Pacaman(ConsoleLib.Coord coordMonsters) : base(coordMonsters, ConsoleColor.Yellow) { ConsoleLib.Coord coordMonsterStart = new ConsoleLib.Coord(); coordMonsterStart = coordMonsters; Life = 3; Score = 0; CountEaten = 1; }
public void OpshionSwitch() { if (OpshionCase == 1) { switch (CurItem) { case 1: ConsoleLib.Coord pos = new ConsoleLib.Coord { y = 10, x = 35 }; List <string> menuVol = new List <string> { " Volume ON ", " Volume OFF " }; Menu volMenu = new Menu(pos, 25, 4, menuVol, 1); volMenu.Draw(); OpshionCase++; ChoiceInsideOptions(); break; case 2: ConsoleLib.Coord posk = new ConsoleLib.Coord { y = 10, x = 35 }; List <string> menuGraphics = new List <string> { " Graphics ON ", " Graphics OFF " }; Menu menuGraphic = new Menu(posk, 25, 4, menuGraphics, 1); menuGraphic.Draw(); OpshionCase += 2; ChoiceInsideOptions(); break; } } else if (OpshionCase == 2) { CreateVolumeSwitch(CurItem); OpshionCase--; } else if (OpshionCase == 3) { CreateGraphicsSwitch(CurItem); OpshionCase -= 2; } }
public AttackMonster(Pacaman pacaman, ConsoleLib.Coord coordMonsters, List <StrategyMove> theOurMove , ConsoleColor color) : base(coordMonsters, color) { _pacman = pacaman; ourMove = new List <StrategyMove>(); ourMove = theOurMove; PrevSymbol = 0; Time = 0; }
public override void Move(MyMap map) { ConsoleKey choice; ConsoleLib.Coord temp = DirectionalCheck(); var Up = ConsoleKey.UpArrow; var Down = ConsoleKey.DownArrow; var Right = ConsoleKey.RightArrow; var Left = ConsoleKey.LeftArrow; var Esc = ConsoleKey.Escape; choice = Console.ReadKey().Key; DeleteDraw(map); if (GetCoordMonster().x != 31) { if ((choice == Right) && (map.GetPointInMap(GetCoordMonster().y, GetCoordMonster().x + 1) != 1)) { SetCoordMonster(GetCoordMonster().y, GetCoordMonster().x + 1); Direction = 4; } } if (GetCoordMonster().x != 0) { if ((choice == Left) && (map.GetPointInMap(GetCoordMonster().y, GetCoordMonster().x - 1) != 1)) { SetCoordMonster(GetCoordMonster().y, GetCoordMonster().x - 1); Direction = 3; } } if ((choice == Down) && (map.GetPointInMap(GetCoordMonster().y + 1, GetCoordMonster().x) != 1)) { SetCoordMonster(GetCoordMonster().y + 1, GetCoordMonster().x); Direction = 2; } if ((choice == Up) && (map.GetPointInMap(GetCoordMonster().y - 1, GetCoordMonster().x) != 1)) { SetCoordMonster(GetCoordMonster().y - 1, GetCoordMonster().x); Direction = 1; } if (choice == Esc) { Draw(map); PauseP(this, EventArgs.Empty); } Draw(map); }
public void PacManMove() { ConsoleLib.Coord temp = PacMan.DirectionalCheck(); Thread.Sleep(100); if (Console.KeyAvailable == true) { PacMan.Move(Map); } else if (Map.GetPointInMap(temp.y, temp.x) != 1) { PacMan.DeleteDraw(Map); PacMan.SetCoordMonster(temp); PacMan.Draw(Map); } }
public Monster(ConsoleLib.Coord coordMonsters, ConsoleColor colors) { _coordMonsterStart = new ConsoleLib.Coord(); _coordMonsterStart = coordMonsters; _coordStartMap.y = 6; _coordStartMap.x = 20; _coordMonster = new ConsoleLib.Coord(); _coordMonster = coordMonsters; color = colors; Direction = 1; SuperMonster = false; }
public Menu(ConsoleLib.Coord pos, int width, int height, List <string> items, int curItem) { _pos = pos; Width = width; Height = height; Items = new List <string>(); Items = items; OpshionCase = 1; ItemCount = Items.Count <= height - 2 ? Items.Count : height - 2; CurItem = (curItem > 0 && curItem <= Items.Count) ? curItem : 1; foregRoundMenuColor = ConsoleColor.White; backgRoundMenuColor = ConsoleColor.Red; foregRoundHighlightColor = ConsoleColor.White; backgRoundHighlightColor = ConsoleColor.Black; Sp = new SoundPlayer("file_example_WAV_10MG.wav"); }
public ConsoleLib.Coord DirectionalCheck() { ConsoleLib.Coord temp = new ConsoleLib.Coord(0, 0); switch (Direction) { case 1: temp.y = GetCoordMonster().y - 1; temp.x = GetCoordMonster().x; break; case 2: temp.y = GetCoordMonster().y + 1; temp.x = GetCoordMonster().x; break; case 3: if (GetCoordMonster().x != 0) { temp.y = GetCoordMonster().y; temp.x = GetCoordMonster().x - 1; } else { temp.y = GetCoordMonster().y; temp.x = 31; } break; case 4: if (GetCoordMonster().x != 31) { temp.y = GetCoordMonster().y; temp.x = GetCoordMonster().x + 1; } else { temp.y = GetCoordMonster().y; temp.x = 0; } break; } return(temp); }
public static void Main(string[] args) { Console.SetWindowSize(100, 45); ConsoleLib.Coord pos = new ConsoleLib.Coord(); pos.y = 10; pos.x = 35; List <string> menuItems = new List <string>(); menuItems.Add(" Start games "); menuItems.Add(" Opshions "); menuItems.Add(" Records "); menuItems.Add(" Exit "); Menu menu = new Menu(pos, 25, 6, menuItems, 1); menu.Draw(); menu.ChoiceOptions(); }
public override void CreatePacman() { var coordPacaman = new ConsoleLib.Coord(); // переменая координат для создания pacamen coordPacaman.x = 1; // начальная точка для pacamen coordPacaman.y = 1; TheGame.PacMan = new Pacaman(coordPacaman); //создание pacamen { TheGame.PacMan.DoPoint += TheGame.ThePoint.Handler; TheGame.PacMan.DoSuperPoint += TheGame.TheSuperPoint.Handler; TheGame.PacMan.EatenMonster += TheGame.Eaten; TheGame.PacMan.EatMonster += TheGame.Eat; TheGame.PacMan.PauseP += TheGame.PauseInGame; } TheGame.DoPointInGame += TheGame.ThePoint.Handler; TheGame.DoSuperPointInGame += TheGame.TheSuperPoint.Handler; }
public override void CreateRed() { ConsoleLib.Coord coordRed = new ConsoleLib.Coord(); // переменая координат для создания red coordRed.x = 15; // начальная точка для red coordRed.y = 11; var RedMove = new List <StrategyMove>(); // масивв стратегий поведания var Red = new RedCreater(); // фабричный метод для стратегий RedMove.Add(Red.CreateFirstStrategy()); // вызов методов и создание стратегий RedMove.Add(Red.CreateSecondStrategy()); RedMove.Add(Red.CreateAfraidStrategy()); TheGame.Monsters.Add(new AttackMonster(TheGame.PacMan, coordRed, RedMove, ConsoleColor.Red)); //создание red { TheGame.PacMan.DoSuperPoint += TheGame.Monsters[0].Handler; TheGame.PacMan.CancelSuperPoint += TheGame.Monsters[0].StopSupurMonstr; } }
public override void CreateBlue() { var coordBlue = new ConsoleLib.Coord(); // переменая координат для создания Blue coordBlue.x = 13; // начальная точка для Blue coordBlue.y = 13; var BlueMove = new List <StrategyMove>(); // масивв стратегий поведания var Blue = new BlueCreater(); // фабричный метод для стратегий BlueMove.Add(Blue.CreateFirstStrategy()); // вызов методов и создание стратегий BlueMove.Add(Blue.CreateSecondStrategy()); BlueMove.Add(Blue.CreateAfraidStrategy()); TheGame.Monsters.Add(new AttackMonster(TheGame.PacMan, coordBlue, BlueMove, ConsoleColor.Blue)); // создание Blue { TheGame.PacMan.DoSuperPoint += TheGame.Monsters[2].Handler; TheGame.PacMan.CancelSuperPoint += TheGame.Monsters[2].StopSupurMonstr; } }
public override void CreateSpeedy() { var coordRed = new ConsoleLib.Coord(); // переменая координат для создания Speedy coordRed.x = 15; // начальная точка для Speedy coordRed.y = 13; var SpeedyMove = new List <StrategyMove>(); // масивв стратегий поведания var Speedy = new SpeedyCreater(); // фабричный метод для стратегий SpeedyMove.Add(Speedy.CreateFirstStrategy()); // вызов методов и создание стратегий SpeedyMove.Add(Speedy.CreateSecondStrategy()); SpeedyMove.Add(Speedy.CreateAfraidStrategy()); TheGame.Monsters.Add(new AttackMonster(TheGame.PacMan, coordRed, SpeedyMove, ConsoleColor.Green)); // создание speedy { TheGame.PacMan.DoSuperPoint += TheGame.Monsters[1].Handler; TheGame.PacMan.CancelSuperPoint += TheGame.Monsters[1].StopSupurMonstr; } }
public void CreateOptionMenu() { ConsoleLib.SetColor(ConsoleColor.White, ConsoleColor.Black); Console.Clear(); ConsoleLib.Coord pos = new ConsoleLib.Coord { y = 10, x = 35 }; List <string> menuOptions = new List <string> { " Volume ", " Graphics " }; Menu newMenu = new Menu(pos, 25, 4, menuOptions, 1); newMenu.Draw(); newMenu.ChoiceInsideOptions(); }
protected void SetCoordMonsterStart(ConsoleLib.Coord coordMonsterStart) => _coordMonsterStart = coordMonsterStart;
public void SetPos(ConsoleLib.Coord pos) => _pos = pos;
public bool IsPosAtItems(ConsoleLib.Coord pos) => (pos.x > _pos.x && pos.x < _pos.x + Width - 1) && (pos.y > _pos.y && pos.y < _pos.y + ItemCount + 1);
public void SetCoordMonster(ConsoleLib.Coord coordMonster) => _coordMonster = coordMonster;
public void SetCoordMonster(int newY, int newX) => _coordMonster = new ConsoleLib.Coord(newY, newX);
public static void WriteChar(ConsoleLib.Coord coordYX, char _symbol) { Console.SetCursorPosition(coordYX.x, coordYX.y); Console.Write(_symbol); }