public void RemoveEntity(EntityAll EA)//移除实体对象 { if (EA is HeroBullet) { this.listHeroBullet.Remove(EA as HeroBullet); } if (EA is EnemyBullet) { this.listEnemyBullet.Remove(EA as EnemyBullet); } if (EA is PlaneEnemy) { this.listPlaneEnemy.Remove(EA as PlaneEnemy); } }
public List <PlaneEnemy> listPlaneEnemy = new List <PlaneEnemy>(); //集合储存敌人 public void AddEntity(EntityAll EA) //添加实体对象 { if (EA is Background) { this.BG = EA as Background; } if (EA is PlaneHero) { this.PH = EA as PlaneHero; } if (EA is HeroBullet) { this.listHeroBullet.Add(EA as HeroBullet);//如果是子弹,则添加到子弹集合 } if (EA is EnemyBullet) { this.listEnemyBullet.Add(EA as EnemyBullet); } if (EA is PlaneEnemy) { this.listPlaneEnemy.Add(EA as PlaneEnemy); } }