/// <summary> /// Returns a <see cref="Avoidance.ObstacleDirectionSpawner"/> based on <see cref="Avoidance.ObstacleSpawnDirection"/>. /// </summary> public ObstacleDirectionSpawner Make(ObstacleSpawnDirection direction) { ObstacleDirectionSpawner directionalSpawner = null; switch (direction) { case ObstacleSpawnDirection.Horizontal: directionalSpawner = new ObstacleDirectionalSpawner(new ObstacleHorizontalDataImpl(Direction.Left, BoundsLocation.RightOffScreen), new ObstacleHorizontalDataImpl(Direction.Right, BoundsLocation.LeftOffScreen)); break; case ObstacleSpawnDirection.Vertical: directionalSpawner = new ObstacleDirectionalSpawner(new ObstacleVerticalDataImpl(Direction.Up, BoundsLocation.BottomOffScreen), new ObstacleVerticalDataImpl(Direction.Down, BoundsLocation.TopOffScreen)); break; } return(directionalSpawner); }
/// <summary> /// Initialise instance and begins spawn. /// </summary> public override void OnStart() { _directionalSpawner = new ObstacleDirectionalSpawnerFactory().Make(spawnDirection); SpawnShape(); }