Esempio n. 1
0
 public Player(Level Level, int Xposition, int Yposition) : base(Level, Xposition, Yposition, ConsoleColor.White)
 {
     Sprite = '☻';
     //Menu.ShowIntro();
     Camera.Render();
     InGameMenu.Update();
 }
Esempio n. 2
0
 public override void ExecuteBehaviour()
 {
     if (IsSolid)
     {
         IsSolid = false;
         Sprite  = ' ';
         InGameMenu.Log("You opened a door.");
     }
     else
     {
         IsSolid = true;
         Sprite  = _auxSprite;
         InGameMenu.Log("You closed a door.");
     }
 }
Esempio n. 3
0
        protected override void ExecuteBehaviour()
        {
            Player p = Level.Player;

            if (Pathfinding.IsNextTo(this, p))
            {
                int damage = new Random().Next(2, 5);
                p.TakeDamage(damage);
                InGameMenu.Log("Took " + damage + " dmg from a zombie");
                if (p.Health <= 0)
                {
                    InGameMenu.Log("Died");
                }
            }
            else
            {
                Move(Pathfinding.NextStep(Xpos, Ypos, p.Xpos, p.Ypos));
            }
        }
Esempio n. 4
0
 private static void ClearMenu()
 {
     Camera.Render();
     InGameMenu.Update();
 }
Esempio n. 5
0
        protected override void ExecuteBehaviour()
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo cki = Console.ReadKey(true);
                switch (cki.Key)
                {
                case ConsoleKey.W:
                case ConsoleKey.UpArrow:
                    Sprite = '▲';
                    Move(Direction.Up);
                    goto default;

                case ConsoleKey.S:
                case ConsoleKey.DownArrow:
                    Sprite = '▼';
                    Move(Direction.Down);
                    goto default;

                case ConsoleKey.A:
                case ConsoleKey.LeftArrow:
                    Sprite = '◄';
                    Move(Direction.Left);
                    goto default;

                case ConsoleKey.D:
                case ConsoleKey.RightArrow:
                    Sprite = '►';
                    Move(Direction.Right);
                    goto default;

                case ConsoleKey.E:
                    Level.Interact(Xorient, Yorient);
                    goto default;

                case ConsoleKey.Spacebar:
                    // carpit
                    foreach (Character z in Level.Characters.ToArray())
                    {
                        if (z.GetType().Name == "Zombie" && z.Xpos == Xorient && z.Ypos == Yorient)
                        {
                            ((Zombie)z).TakeDamage(_damage);
                            if (((Zombie)z).Health > 0)
                            {
                                InGameMenu.Log("Hit a zombie for 5 dmg");
                            }
                            else if (((Zombie)z).Health == 0)
                            {
                                InGameMenu.Log("Killed a zombie");
                                _health += 3;
                                if (_health > 18)
                                {
                                    _health = 18;
                                }
                            }
                        }
                    }
                    if (Level.Characters.Count == 1)
                    {
                        InGameMenu.Log("Killed all zombies");
                        Game.IsAlive = false;
                        Game.IsWon   = true;
                    }
                    goto default;

                default:
                    Level.Update();
                    Camera.Render();
                    InGameMenu.Update();
                    break;
                }
            }
        }