コード例 #1
0
 static void Main(string[] args)
 {
     Enemy[] enemies = new Enemy[5];
     enemies[0] = new UFO();
     enemies[1] = new Star();
     enemies[2] = new Star();
     enemies[3] = new Meteor();
     enemies[4] = new Meteor();
     foreach (var e in enemies)
     {
         e.Move();
     }
 }
コード例 #2
0
 static void Main(string[] args)
 {
     Enemy[] enemies = new Enemy[5];
     enemies[0] = new UFO();
     enemies[1] = new Star();
     enemies[2] = new Star();
     enemies[3] = new Meteor();
     enemies[4] = new Meteor();
     for (int i = 0; i < enemies.Length; i++)  //forreach(Enemy e in enemies){}
     {
         enemies[i].Move();
     }
 }