//将创建的游戏对象添加到窗体中 public void AddGameObj(GameObj ob)//不确定要添加哪个对象,所以添加父类 { if (ob is BackGround) { this.BG = ob as BackGround; } else if (ob is PlanePlayer) //判断传入对象是否是玩家飞机 { this.PP = ob as PlanePlayer; //转换成玩家飞机,赋值给玩家属性 } else if (ob is PlayerBullet) //添加玩家子弹 { listPlayerBullet.Add(ob as PlayerBullet); } else if (ob is PlaneEnemy)//将ob对象赋值给PlaneEnemy,加载到敌人飞机的集合当中 { listplaneEnemies.Add(ob as PlaneEnemy); } else if (ob is EnemyExplosion)//将ob对象赋值给 EnemyExplosio,加载到敌人飞机爆炸的集合当中 { listenemyExplosions.Add(ob as EnemyExplosion); } else if (ob is EnemyBullet) { listenemyBullets.Add(ob as EnemyBullet);//添加敌人子弹到集合中 } else if (ob is PlayerExplosion) { listplayerExplosions.Add(ob as PlayerExplosion); } else if (ob is Supplies) { listSupllies.Add(ob as Supplies); } else if (ob is Rocks) { listRocks.Add(ob as Rocks); } else if (ob is PlayerSkill) { listplayerSkill.Add(ob as PlayerSkill); } }