protected override void Init() { // Already initialized? if (m_Type != null) { return; } if (s_Texts == null) { s_Texts = new Texts(); } m_Type = GetProperty("type"); List <SerializedProperty> shownPlanes = new List <SerializedProperty>(); for (int i = 0; i < m_Planes.Length; ++i) { m_Planes[i] = GetProperty("plane" + i); // Keep name in sync with transfer func in CollisionModule.h System.Diagnostics.Debug.Assert(m_Planes[i] != null); // Always show the first plane if (i == 0 || m_Planes[i].objectReferenceValue != null) { shownPlanes.Add(m_Planes[i]); } } m_ShownPlanes = shownPlanes.ToArray(); m_Dampen = new SerializedMinMaxCurve(this, s_Texts.dampen, "m_Dampen"); m_Dampen.m_AllowCurves = false; m_Bounce = new SerializedMinMaxCurve(this, s_Texts.bounce, "m_Bounce"); m_Bounce.m_AllowCurves = false; m_LifetimeLossOnCollision = new SerializedMinMaxCurve(this, s_Texts.lifetimeLoss, "m_EnergyLossOnCollision"); m_LifetimeLossOnCollision.m_AllowCurves = false; m_MinKillSpeed = GetProperty("minKillSpeed"); m_MaxKillSpeed = GetProperty("maxKillSpeed"); m_RadiusScale = GetProperty("radiusScale"); m_PlaneVisualizationType = (PlaneVizType)EditorPrefs.GetInt("PlaneColisionVizType", (int)PlaneVizType.Solid); m_ScaleGrid = EditorPrefs.GetFloat("ScalePlaneColision", 1f); s_VisualizeBounds = EditorPrefs.GetBool("VisualizeBounds", false); m_CollidesWith = GetProperty("collidesWith"); m_CollidesWithDynamic = GetProperty("collidesWithDynamic"); m_MaxCollisionShapes = GetProperty("maxCollisionShapes"); m_Quality = GetProperty("quality"); m_VoxelSize = GetProperty("voxelSize"); m_CollisionMessages = GetProperty("collisionMessages"); m_CollisionMode = GetProperty("collisionMode"); m_ColliderForce = GetProperty("colliderForce"); m_MultiplyColliderForceByCollisionAngle = GetProperty("multiplyColliderForceByCollisionAngle"); m_MultiplyColliderForceByParticleSpeed = GetProperty("multiplyColliderForceByParticleSpeed"); m_MultiplyColliderForceByParticleSize = GetProperty("multiplyColliderForceByParticleSize"); SyncVisualization(); }
private static int LoadProjectPrefModeIndex() { return(EditorPrefs.GetInt(GetProjectPrefKeyName(k_ModeIndexKeyName), 0)); }