using System.Collections; using System.Collections.Generic; using UnityEngine; public class CloneWarningLine : CloneMultiLine { // Use this for initialization public override void Awake () { variableX = 100; variableY = 50; variableZ = 80; cloneObjType = CloneObjType.WarningLine; ResourcesName = "Prefab/Tool/WarningLine"; parentResourcesName = "Prefab/Tool/WarningLineParent"; base.Awake(); } protected override void SetClonedObj(GameObject clonedObj) { clonedObj.transform.forward = (curPos - prePos).normalized;//改变线条的朝向 float distance = Vector3.Distance(prePos, curPos);//计算两点的距离 clonedObj.transform.localScale = new Vector3(variableX, variableY, distance * variableZ);//延长线条,连接两点。 } }