コード例 #1
0
        public void DoTo(string name)
        {
            int i;

            for (i = 0; i < arr.Count; i++)
            {
                BeHavior myp = (BeHavior)arr[i];
                if (myp.Name == name)
                {
                    myHat       = HatFactory.CreateHat(myp);
                    myEquipment = EquipmentFactory.CreateEquipment(myp);
                    myp.Doto();
                    break;
                }
            }
        }
コード例 #2
0
        public static Equipment CreateEquipment(BeHavior b)
        {
            Equipment eq = null;
            string    bs = b.Name;

            switch (bs)
            {
            case "外出":
                eq = new Armor();
                break;

            case "游戏":
                eq = new Knife();
                break;
            }
            return(eq);
        }
コード例 #3
0
        public static Hat CreateHat(BeHavior b)
        {
            Hat    hat = null;
            string bn  = b.Name;

            switch (bn)
            {
            case "外出":
                hat = new WalkHat();
                break;

            case "游戏":
                hat = new SwimmingHat();
                break;
            }
            return(hat);
        }