//Function: RemoveAllIntrest //Argument: IntrestedObj //Purpose: This function removes the IntrestedObj from all the function // codes it was intrested in. public void RemoveAllIntrest( IntrestedObj t_iObj ) { foreach(ushort t_code in m_funcCodeIDList ) { List<IntrestedObj> t_list; m_funcCodeIntrestList.TryGetValue(t_code, out t_list); t_list.Remove(t_iObj); m_funcCodeIntrestList[t_code] = t_list; } }
//Function: RemoveIntrest //Argument: IntrestedObj //Argument: ushort //Purpose: To remove the intrest of a IntrestedObj from a specific // function code public void RemoveIntrest( IntrestedObj t_iObj , ushort t_code ) { if(!m_funcCodeIntrestList.ContainsKey ( t_code )){ Debug.Log("FUNCTION CODE: " + t_code.ToString() + " does not exist \n Could not remove obj"); return; } List<IntrestedObj> t_list; m_funcCodeIntrestList.TryGetValue(t_code, out t_list); t_list.Remove(t_iObj); m_funcCodeIntrestList[t_code] = t_list; }
//Function: AddRPCIntrest //Argument: none //Purpose: Here the Intrested objects identify that they want to be // informed of any BinaryMessages that have been recived with // a certian function code. public void AddRPCIntrest(IntrestedObj t_iOBJ, ushort t_code) { //if key doesnt exist then print error and return if( !m_funcCodeIntrestList.ContainsKey( t_code ) ) { Debug.Log("FUNCTION_CODE: " + t_code.ToString () + " does not exist\n Could not remove"); return; } List<IntrestedObj> t_list; m_funcCodeIntrestList.TryGetValue(t_code, out t_list); t_list.Add(t_iOBJ); m_funcCodeIntrestList[t_code] = t_list; }