private bool addPlayerToTeam(Player player,int[] team) { foreach (int slotId in team) { SLOT slot = getRoomSlot(slotId); if (slot.getState() == SLOT_STATE.SLOT_STATE_EMPTY) { slot.setPlayer(player); slot.setState(SLOT_STATE.SLOT_STATE_NORMAL); players.Add(player.PlayerID,player); return(true); } } return(false); }
public SLOT changeTeam(Player player,int team) { SLOT slot = getRoomSlotByPlayer(player); foreach (int teamSlot in team == 0 ? RED_TEAM : BLUE_TEAM) { SLOT rslot = ROOM_SLOT[teamSlot]; if (player.Equals(rslot.getPlayer()) || rslot.getState() == SLOT_STATE.SLOT_STATE_EMPTY) { slot.setPlayer(null); slot.setState(SLOT_STATE.SLOT_STATE_EMPTY); rslot.setPlayer(player); rslot.setState(SLOT_STATE.SLOT_STATE_NORMAL); return(rslot); } } return(null); }