void CreateFromString(string s) { if (!Enum.TryParse <T>(s, out EnumType)) { EnumType = (T)Enum.ToObject(typeof(T), MyLibraryUtils.GetHash(s)); } #if SUPPORT_STRING_SAVE EnumString = s; #endif m_enumInt = ((IConvertible)EnumType).ToInt32(System.Globalization.CultureInfo.InvariantCulture); }
public void AddEdgeInfo(ref Vector3 point0, ref Vector3 point1, ref Vector3 normal0, ref Vector3 normal1, Color color, MySlimBlock owner) { var hash = CalculateEdgeHash(point0, point1); var pos = (point0 + point1) * 0.5f; Vector3I direction = Vector3I.Round((point0 - point1) / m_gridRender.GridSize); MyEdgeInfo info = new MyEdgeInfo(ref pos, ref direction, ref normal0, ref normal1, ref color, MyLibraryUtils.GetHash(owner.BlockDefinition.EdgeType)); var cell = GetCell(pos); if (cell.AddEdgeInfo(hash, info, owner)) { m_dirtyCells.Add(cell); } }