public virtual void AddObject(GameObject obj) { if (obj is MovingObjects) { this.AddMovingObject(obj as MovingObjects); } else { if (obj is Spaceship) { AddSpaceship(obj); } else if (obj is Alien) { AddAlien(obj); } else { this.AddStaticObject(obj); } } }
private void AddSpaceship(GameObject obj) { this.playerSpaceship = obj as Spaceship; this.AddStaticObject(obj); }
private void AddStaticObject(GameObject obj) { this.staticObjects.Add(obj); this.allObjects.Add(obj); }
private void AddAlien(GameObject obj) { this.playerAlien = obj as Alien; this.AddStaticObject(obj); }