public bool TypeMatches(ToffeeNetwork network, object o) { Type t = o.GetType(); ToffeeValueType toffeeType = GetToffeeValueTypeFromType(network, t); if (toffeeType == BaseType) { if ((toffeeType != ToffeeValueType.Array) && (toffeeType != ToffeeValueType.Struct)) { return(true); } else { if (t.IsArray) { return(SubType.TypeMatches(network, t.GetElementType())); } else if ((t.IsValueType) && (network.HasObject <ToffeeStruct>(t.FullName))) { return(StructId == network.GetObject <ToffeeStruct>(t.FullName).ObjectId); } } } return(false); }