Example #1
0
        static void Main(string[] args)
        {
            // 1匹目
            Pachimon pekachu1 = new Pachimon("ぺかちゅう");

            pekachu1.ShowName("このパチモンは ");
            pekachu1.ShowSkill();

            // 2匹目
            Pachimon pekachu2 = new Pachimon("ぺかちゅう2号", "十ボルト");

            pekachu2.ShowName();
            pekachu2.ShowSkill();
        }
Example #2
0
        static void Main(string[] args)
        {
            // 1匹目
            Pachimon pekachu1 = new Pachimon("ぺかちゅう");

            pekachu1.ShowName();
            pekachu1.ShowSkill();

            // 2匹目
            Pachimon pekachu2 = new PachittoMonster.Pachimon("ぺかちゅう2号");

            pekachu2.ShowName();
            pekachu2.Skill = "十ボルト";
            pekachu2.ShowSkill();
        }
Example #3
0
        /// <summary>
        /// 指定された番号のパチモンを生成
        /// </summary>
        /// <param name="no">番号</param>
        public Pachimon create(int no)
        {
            Pachimon pachimon = null;

            if (no == 1)
            {
                pachimon = new Pekachu();
            }

            if (no == 2)
            {
                pachimon = new Husigidana();
            }

            if (no == 3)
            {
                pachimon = new Dorugame();
            }

            return(pachimon);
        }
Example #4
0
        static void Main(string[] args)
        {
            PachimonFactory pachimonFactory = new PachimonFactory();

            Pachimon patimon1 = pachimonFactory.create(1);

            patimon1.ShowDetail();

            System.Console.WriteLine();
            System.Console.WriteLine("-------------------");
            System.Console.WriteLine();

            Pachimon patimon2 = pachimonFactory.create(2);

            patimon2.ShowDetail();

            System.Console.WriteLine();
            System.Console.WriteLine("-------------------");
            System.Console.WriteLine();

            Pachimon patimon3 = pachimonFactory.create(3);

            patimon3.ShowDetail();
        }