海淀天下城电子沙盘单机版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

85 lines
3.7 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CloneBrokenLine : CloneDashedLine
{
// Use this for initialization
public override void Awake()
{
cloneObjType = CloneObjType.BrokenLine;
parentResourcesName = "Prefab/Tool/BrokenLineParent";
ResourcesName = "Prefab/Tool/BrokenItem";
base.Awake();
}
protected override void SetDirect(GameObject cloneObj)
{
cloneObj.transform.right = (-(curPos - prePos)).normalized;
}
/*protected override void DrawLine(Vector3 prePos, Vector3 curPos, GameObject nowObj)
{
Vector3 vertPos;
var Distance = Vector3.Distance(prePos, curPos);
float pos = Mathf.CeilToInt(Distance);
float count = Mathf.CeilToInt(pos / 3);
int dex = 1;
if (count < 1)
{
count = 1;
dex = 0;
}
for (int i = 0; i < count + dex; i++)
{
if (count > 1)
{
if (i != 0)
{
vertPos = new Vector3(prePos.x + (i / (float)count) * (curPos.x - prePos.x), prePos.y + (i / (float)count) * (curPos.y - prePos.y), prePos.z + (i / (float)count) * (curPos.z - prePos.z));
GameObject cloneObj = Instantiate(clonePrefab, vertPos, Quaternion.identity) as GameObject;
cloneObj.name = nowObj.name;
cloneObj.transform.parent = nowObj.transform;
cloneObj.transform.right = (-(curPos - prePos)).normalized;
//设定id为父物体id
CloneGameObjInfo objMsg = cloneObj.GetComponent<CloneGameObjInfo>();
objMsg.gameObjID = nowObj.GetComponent<CloneGameObjInfo>().gameObjID;
objMsg.gameObjType = cloneObjType;
//设置克隆物体所在楼层属性,属性从点击的对象上获取
var hitObj = EntitiesManager.Instance.GetEntityByID(data.gameObjID);
CloneGameObjInfo floorMsg = hitObj.GetComponent<CloneGameObjInfo>();
objMsg.buildNum = floorMsg.buildNum;
objMsg.floorNum = floorMsg.floorNum;
objMsg.interlayerNum = floorMsg.interlayerNum;
SelectedObjs.gameObjs.Add(cloneObj);
SetCloneGameObject(cloneObj);
AddRecordEventCloneChild(cloneObj.transform); //记录克隆子物体
}
}
else
{
GameObject cloneObj = Instantiate(clonePrefab, curPos, Quaternion.identity) as GameObject;
cloneObj.name = nowObj.name;
cloneObj.transform.parent = nowObj.transform;
cloneObj.transform.forward = ((curPos - prePos)).normalized;
//设定id为父物体id
CloneGameObjInfo objMsg = cloneObj.GetComponent<CloneGameObjInfo>();
objMsg.gameObjID = nowObj.GetComponent<CloneGameObjInfo>().gameObjID;
objMsg.gameObjType = cloneObjType;
//设置克隆物体所在楼层属性,属性从点击的对象上获取
var hitObj = EntitiesManager.Instance.GetEntityByID(data.gameObjID);
CloneGameObjInfo floorMsg = hitObj.GetComponent<CloneGameObjInfo>();
objMsg.buildNum = floorMsg.buildNum;
objMsg.floorNum = floorMsg.floorNum;
objMsg.interlayerNum = floorMsg.interlayerNum;
SelectedObjs.gameObjs.Add(cloneObj);
SetCloneGameObject(cloneObj);
AddRecordEventCloneChild(cloneObj.transform); //记录克隆子物体
}
}
}*/
}