コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Character type:");
            Console.WriteLine("\t1-Wizard");
            Console.WriteLine("\t2-Warrior");
            Console.WriteLine("\t3-Rogue");
            string type = Console.ReadLine();

            Console.WriteLine("Name: ");
            string name = Console.ReadLine();

            /*
             * switch (type) {
             *  case "1":
             *      Wizard wizard = new Wizard (name, 3);
             *      break;
             *  case "2":
             *      Warrior warrior = new Warrior (name);
             *      break;
             *  case "3":
             *      Rogue roque = new Rogue (name);
             *      break;
             *
             *  default:
             *      break;
             * }
             */

            Character myCharacter = null; //null es que ahorita no tiene nada

            switch (type)
            {
            case "1":
                myCharacter = new Wizard(name, 3);
                break;

            case "2":
                myCharacter = new Warrior(name);
                break;

            case "3":
                myCharacter = new Rogue(name);
                break;

            default:
                break;
            }

            if (myCharacter != null)
            {
                myCharacter.ShowActionMenu();
            }

            Console.ReadLine();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Character type:");
            Console.WriteLine("\t1-Wizard");
            Console.WriteLine("\t2-Warrior");
            Console.WriteLine("\t3-Rogue");
            string type = Console.ReadLine();

            Console.WriteLine("Name:");
            string name = Console.ReadLine();

            Character myCharacter = null;

            switch (type)
            {
            case "1":
                myCharacter = new Wizard(name);
                break;

            case "2":
                myCharacter = new Warrior(name);
                break;

            case "3":
                myCharacter = new Rogue(name);
                break;

            default:
                Console.WriteLine("No DLC");
                break;
            }

            if (myCharacter != null)
            {
                myCharacter.ShowActionMenu();
            }


            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Jazh/Visual
        static void Main(string[] args)
        {
            Console.WriteLine("Character type");
            Console.WriteLine("\t1-Wizard");
            Console.WriteLine("\t1-Warrior");
            Console.WriteLine("\t1-Rogue");

            string type = Console.ReadLine();

            Console.WriteLine("Escribe un nombre");
            string name = Console.ReadLine();

            Character character = null;

            switch (type)
            {
            case "1":
                character = new Wizard(name);
                break;

            case "2":
                character = new Warrior(name);
                break;

            case "3":
                character = new Rogue(name);
                break;

            default:
                break;
            }

            if (character != null)
            {
                character.Atack();
            }
        }