public Paddle( IPlayerController player, IParticleEngine particleEngine, PaddleState state) { State = state; SpriteState = state.SpriteState; _player = player; _particleEngine = particleEngine; }
public PongPlayer( IPlayerController player, Paddles position, IParticleEngine particleEngine, PlayerName playerName, Goal?goal = null, Paddles?statsPosition = null, PongPlayerState?state = null) { State = state ?? new PongPlayerState(); _statsPosition = statsPosition; State.Position = position; Paddle = new Paddle(player, particleEngine, State.PaddleState) { PlayerName = playerName, Speed = 300 }; Goal = goal ?? new Goal(State.GoalState); PlayerStats = new PlayerStats(State.StatsState); PlayerStats.State.PlayerName = playerName; }
public Ship( IParticleEngine particleEngine, IRandomizer randomizer, ShipState?state = null) { _particleEngine = particleEngine ?? throw new ArgumentNullException(nameof(particleEngine)); _randomizer = randomizer ?? throw new ArgumentNullException(nameof(randomizer)); // Size = Vector2.Zero; //AngularVelocity = 1f; EngineTimer.EveryNumOfSeconds = 0.5f; EngineTimer.Restart(); ExplosionTimer.EveryNumOfSeconds = 0.3f; ExplosionTimer.Restart(); if (state != null) { foreach (var spriteState in state.Balls) { shipBullets.Add(new Ball(_randomizer, new GameTimer()) { State = spriteState }); } } else { state = new ShipState(); state.SpriteState.Size = Vector2.Zero; state.SpriteState.AngularVelocity = 1f; for (int i = 0; i < 4; i++) { var ball = new Ball(_randomizer, new GameTimer()); shipBullets.Add(ball); state.Balls.Add(ball.State); } } State = state; SpriteState = state.SpriteState; }