19 lines
		
	
	
		
			700 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			700 B
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| 
 | |
| public class Wirepoint : MonoBehaviour
 | |
| {
 | |
|     [ContextMenu("Rename")]
 | |
|     void ResetName()
 | |
|     {
 | |
|         Te root = GetComponentInParent<Te>();
 | |
|         int index = int.Parse(root.name.Split('#')[0]);
 | |
|         string XiangWei = transform.parent.name.Remove(2);
 | |
|         transform.GetChild(0).name = (index - 1) + "-" + index + "_"+ XiangWei + "_End";
 | |
|         FindObjectOfType<WireTool>().EndPoints.Add(transform.GetChild(0).gameObject);
 | |
|         transform.GetChild(1).name = index + "-" + (index + 1) + "_" + XiangWei + "_Start";
 | |
|         FindObjectOfType<WireTool>().StartPoints.Add(transform.GetChild(1).gameObject);
 | |
|     }
 | |
| }
 |