public IActionResult Shoot([FromBody] PlayerShootInfo shootInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var gameRoom = _gameRooms.GameRoomsList.Find(r => r.RoomID == shootInfo.RoomID); if (gameRoom == null) { return(BadRequest("Wrong Room Id")); } var playerRoomId = gameRoom.GetPlayerRoomId(shootInfo.PlayerKey); if (playerRoomId != 0 && playerRoomId != 1) { return(BadRequest("Wrong Player Key")); } if (!gameRoom.GameOn) { return(BadRequest("Players did not sets theirs maps yet")); } string result = gameRoom.PlayerShootReq(shootInfo.PlayerKey, shootInfo.X, shootInfo.Y); return(Ok(new RoomstateInfo() { RoomID = gameRoom.RoomID, OponentName = gameRoom.PlayersNames[(playerRoomId + 1) % 2], AskingPlayerTurn = gameRoom.IsPlayerTurn(shootInfo.PlayerKey), LastAction = gameRoom.LastAction, GameOn = gameRoom.GameOn })); }
public virtual void OnPlayerShoot(PlayerShootInfo p_playerShootInfo) { }