public LetterState Execute(int x, int y) { Logger.Log("Click - ( " + x + " ; " + y + " )"); Position position = new Position(x, y); var pickedPositionState = gameService.SelectLetterPosition(position); if (gameService.CheckIfWin()) { Logger.Log("-- Game Finish --"); OnWinGame?.Invoke(); } return(pickedPositionState); }
public void Update(float dt) { if (enemies.Count <= 0) { OnWinGame?.Invoke(); } foreach (Enemy i in enemies) { if (rand.Next(0, 100) < 2) { bullets.Add(i.Fire()); } i.Update(dt); } var tmp = CheckEnenymiesCollisions(); foreach (Enemy i in tmp) { i.Update(-dt); i.Reverse(); } foreach (Enemy i in enemies.Except(tmp)) { if (rand.Next(0, 100) < 5) { i.RandomDirection(); } } CheckBulletsCollisions(); UserUpdate(dt); foreach (GameObj i in bullets.Concat(user.bullets)) { i.Update(dt); } if (pressedKeys.Contains(Key.Space) && (DateTime.Now - lastFire).TotalSeconds > 1) { user.Fire(); lastFire = DateTime.Now; } }