Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
 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));
     }
 }
Exemple #3
0
 public void PlaceObject(PlaceObj pos, PlaceElement pickup)
 {
     pos.PlaceObject(pickup);
 }