示例#1
0
文件: Game.cs 项目: zelham/test-sql
        public void PlayGame(Entity player, Entity enemy1, Entity enemy2)
        {
            float health = player.GetHealth();

            Console.WriteLine("The player has " + health + " health.");

            // Combat

            if (!(player is Enemy))
            {
                Console.WriteLine("Player is not an ememy");
            }

            // Display what everyone is weilding
            if (player is Player)
            {
                Player p1 = (Player)player;
                p1.PrintHoldable();

                Holdable holdable = p1.GetHoldable();
                if (holdable.IsEpicWeapon)
                {
                    EpicWeapon e1            = (EpicWeapon)holdable;
                    string     specialAttack = "Player is attacking with special: " + e1.GetEpicMove();
                    Console.WriteLine(specialAttack);
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Holdable   axe        = new Weapon("Axe");
            EpicWeapon epicWeapon = new EpicWeapon("Legendary Sword");

            Holdable fireball = new Spell("Fireball");
            Holdable gas      = new Spell("Gas");

            Game   game   = new Game();
            Entity player = new Player(100, epicWeapon);
            Entity enemy1 = new Enemy(100, fireball);
            Entity enemy2 = new Enemy(100, gas);

            game.PlayGame(player, enemy1, enemy2);

            Console.ReadKey();
        }