public virtual void AddObject(GameObject obj) { if (obj is MovingObject) { this.AddMovingObject(obj as MovingObject); } else { if (obj is Racket) { AddRacket(obj); } else { this.AddStaticObject(obj); } } }
private void AddStaticObject(GameObject obj) { this.staticObjects.Add(obj); this.allObjects.Add(obj); }
private void AddRacket(GameObject obj) { if (this.playerRacket != null) { this.allObjects.Remove(this.playerRacket); this.staticObjects.Remove(this.playerRacket); } this.playerRacket = obj as Racket; this.AddStaticObject(obj); }