public void AddObject(GameObject obj) { if (obj is Vehicle) { Vehicle tempVehicle = obj as Vehicle; for (int i = 0; i < tempVehicle.Length; i++) { this.allObjects.Add(new Vehicle(new Coordinates(tempVehicle.TopLeft.Row, tempVehicle.TopLeft.Col + i), tempVehicle.Speed)); } } else if (obj is Frog) { playerFrog = obj as Frog; this.frogStartingPosition = playerFrog.TopLeft; } this.allObjects.Add(obj); }
public MovingObject(Coordinates topLeft, int speed, char[] body) : base(topLeft, body) { this.Speed = speed; }