コード例 #1
0
        public Monster Create(MonsterType type)
        {
            Monster monster = null;

            switch (type)
            {
            case MonsterType.Aquatic:
                monster = new SeaMonster(100, 25);
                break;

            case MonsterType.Aerial:
                monster = new FlyingMonster(100, 35);
                break;

            case MonsterType.Terrestrial:
                monster = new LandMonster(100, 45);
                break;

            default:
                throw new System.ComponentModel.InvalidEnumArgumentException($"Invalid MonsterType option ({type})");
            }

            return(monster);
        }
コード例 #2
0
 // Use this for initialization
 void Start()
 {
     seaMonster = seaMonsterObj.GetComponent <SeaMonster>();
 }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     seaMonster = seaMonsterObj.GetComponent<SeaMonster>();
 }