예제 #1
0
        public JoinGameResult AttemptToJoinHeist(string displayName, out HeistRoles role)
        {
            bool success;

            (success, role) = MyRandom.ChooseRandomItem(GetAvailableRoles());
            if (!success)
            {
                return(HeistJoinResults.HeistFullResult(displayName));
            }

            return(AttemptToJoinHeist(displayName, role));
        }
예제 #2
0
        public JoinGameResult AttemptToJoinHeist(string displayName, HeistRoles role)
        {
            if (_heistMembers.ContainsValue(displayName))
            {
                return(HeistJoinResults.AlreadyInHeistResult(displayName));
            }

            if (_heistMembers.ContainsKey(role))
            {
                return(HeistJoinResults.RoleTakenResult(displayName, role));
            }

            _heistMembers.Add(role, displayName);

            return(HeistJoinResults.SuccessJoinResult(displayName, role));
        }