// void ProvideSpawnPoints(WaveManager waveManager) // { // waveManager.SpawnPoints = new Dictionary<string, Vector2>(); // for (int i = 0; i < Curves.Count; i++) // { // waveManager.SpawnPoints.Add(Curves[i].name, Curves[i].FirstSegment); // } // } public void AddCurve() { BezierCurve newCurve = Editor.Instantiate(BezierCurvePrefab).GetComponent <BezierCurve>(); newCurve.transform.parent = _transform; newCurve.transform.position = _transform.position; newCurve.gameObject.name = DefaultName + newCurve.transform.GetSiblingIndex().ToString(); newCurve.Init(_transform.position, this); Curves.Add(newCurve); if (Curves.Count == 1) { Selection.activeObject = Curves[0].gameObject; } }
public void Init(Vector2 centre, RoadCreator creator) { Curve = gameObject.AddComponent <BezierCurve>(); Curve.Init(centre, creator); Material newMaterial = new Material(Shader.Find("Unlit/Transparent")); newMaterial.name = gameObject.name; materialAssetPath = $"Assets/Materials/{newMaterial.name}.mat"; if (!AssetDatabase.IsValidFolder(materialAssetPath)) { AssetDatabase.CreateAsset(newMaterial, materialAssetPath); } MeshRenderer.sharedMaterial = newMaterial; MeshRenderer.sharedMaterial.mainTexture = Texture; UpdatePath(); }