public void UpdatePlaceState() { if (pickedUpObj == null) { return; } if (!pickedUpObj.Active) { resonwhy = "当前步骤无需该零件!"; installAble = false; } else { ray = viewCamera.ScreenPointToRay(Input.mousePosition); hits = Physics.RaycastAll(ray, hitDistence, PlacePoslayerMask); if (hits != null || hits.Length > 0) { var hitedObj = false; for (int i = 0; i < hits.Length; i++) { installPos = hits[i].collider.GetComponentInParent <PlaceObj>(); if (installPos) { hitedObj = true; installAble = CanPlace(installPos, pickCtrl.pickedUpObj, out resonwhy); if (installAble) { break; } } } if (!hitedObj) { installAble = false; resonwhy = "零件放置位置不正确"; } } } if (installAble) { //可安装显示绿色 if (activeNotice) { highLight.HighLightTarget(pickedUpObj.Render, Color.green); } } else { //不可安装红色 if (activeNotice) { highLight.HighLightTarget(pickedUpObj.Render, Color.red); } } }
public bool CanPlace(PlaceObj pos, PickUpAbleItem element, out string why) { if (pos == null) { Debug.LogError(""); why = "【配制错误】:零件未挂PlaceObj脚本"; return(false); } else { return(pos.CanPlace(element, out why)); } }
public void PlaceObject(PlaceObj pos, PlaceElement pickup) { pos.PlaceObject(pickup); }