void ChangeTurningRange(float angle) { Destroy(turningRange.GetComponent <MeshFilter>().mesh); angle = Mathf.Min(angle, 180); turningRange.GetComponent <MeshFilter>().mesh = GeoGenerator.SectorPlane((int)angle * 2, 0.7f, 0.67f); turningRange.rotation = model.rotation; turningRange.position = new Vector3(model.position.x, turningRange.position.y, model.position.z); }
public override void OnInspectorGUI() { DrawDefaultInspector(); WeaponConfig config = target as WeaponConfig; Weapon weapon = config.weapon; if (weapon != null) { weapon.far = EditorGUILayout.Slider("far", weapon.far, 0f, 3f); weapon.near = EditorGUILayout.Slider("near", weapon.near, 0f, 3f); weapon.angle = EditorGUILayout.IntSlider("angle", weapon.angle, 0, 180); if (GUILayout.Button("Config")) { Mesh mesh = GeoGenerator.SectorPlane(weapon.angle, weapon.far, weapon.near); config.GetComponent <MeshFilter>().mesh = mesh; EditorUtility.SetDirty(weapon); } } }