private void AddPlayer(InputDevice device, PlayerActions actions) { if (connectedPlayers == maxPlayers) { throw new TooManyPlayersException(); } // You can't have more than one player on the same device var existing = assignments.FindAll(a => a.device == device); if (existing.Count > 0) { throw new MultipleBindingException(); } connectedPlayers++; var assignment = new PlayerAssignment() { playerNum = connectedPlayers, device = device, actions = actions }; assignments.Add(assignment); }
public void DraftPlayer(PlayerAssignment player) { try { _context.PlayerAssignments.Add(player); _context.SaveChanges(); } catch (Exception e) { ; } }
public void AddStatusForPlayer(PlayerAssignment a) { GameObject playerHUD = ((GameObject)Instantiate(statusPrefab, new Vector3(0, 0, 0), Quaternion.identity)); Vector3 playersArea = camera.ViewportToWorldPoint(new Vector3(0.1f, 1f, 0)); // parent it and scale it properly.. playerHUD.transform.SetParent(canvas.transform); playerHUD.transform.localScale = new Vector3(1, 1, 1); playerHUD.transform.position = new Vector3(playersArea.x, playersArea.y - (10 * a.playerNum), 0); // Hook it up with the player PlayerStatus newStatus = playerHUD.GetComponent <PlayerStatus>(); newStatus.player = a.playerObject.GetComponent <Player>(); }
public void AddPlayer(int franchiseId, int playerId) { var player = _players.Get(playerId); if (player != null) { PlayerAssignment playerAssign = new PlayerAssignment { FranchiseId = franchiseId, PlayerId = playerId, DateDrafted = DateTime.Now, PlayerPosition = player.Position, }; _players.DraftPlayer(playerAssign); } // return RedirectToAction( "Details", "Owners", new { id = ownerId } ); }
private void Awake() { spawner = GameObject.FindGameObjectWithTag("Spawner"); p = spawner.GetComponent <PlayerAssignment>(); }
public List <PlayerAssignment> loadPlayerTeam(UInt32 id, MemoryStream memory1, BinaryReader reader) { List <PlayerAssignment> list = new List <PlayerAssignment>(); int bytesPlayer = (int)memory1.Length; int bloques_assig = bytesPlayer / block; reader.BaseStream.Position = 0; for (int i = 0; (i <= (bloques_assig - 1)); i++) { reader.BaseStream.Position += 8; UInt32 Team = reader.ReadUInt32(); if (Team == id) { reader.BaseStream.Position -= 12; UInt32 Index_PLASSIG = reader.ReadUInt32(); UInt32 Player_id = reader.ReadUInt32(); reader.BaseStream.Position += 4; byte number = reader.ReadByte(); UInt16 Valor_partido = reader.ReadUInt16(); UInt32 CHECK46 = (ushort)(Valor_partido << 4); CHECK46 = CHECK46 >> 15; //CAPTAIN UInt32 CHECK47 = (ushort)(Valor_partido << 5); CHECK47 = CHECK47 >> 15; //PENALTY_KICK UInt32 CHECK48 = (ushort)(Valor_partido << 6); CHECK48 = CHECK48 >> 15; //LONG_SHOT UInt32 CHECK49 = (ushort)(Valor_partido << 7); CHECK49 = CHECK49 >> 15; //LEFT_CK UInt32 CHECK50 = (ushort)(Valor_partido << 8); CHECK50 = CHECK50 >> 15; //SHORT_FOUL UInt32 CHECK51 = (ushort)(Valor_partido << 9); CHECK51 = (CHECK51 >> 15); //RIGHT_CK UInt16 Order_in_Team = (ushort)(Valor_partido << 10); Order_in_Team = (ushort)(Order_in_Team >> 10); PlayerAssignment temp = new PlayerAssignment(Player_id, Team); temp.setShirtNumber(number); temp.setEntryId(Index_PLASSIG); temp.setCaptain(CHECK46); temp.setPenaltyKick(CHECK47); temp.setLongShotLk(CHECK48); temp.setLeftCkTk(CHECK49); temp.setShortFoulFk(CHECK50); temp.setRightCornerKick(CHECK51); temp.setOrder(Order_in_Team); list.Add(temp); reader.BaseStream.Position += 1; } else { reader.BaseStream.Position += 4; } } return(list); }