/// <summary>
 /// 定位安装
 /// </summary>
 /// <param name="target"></param>
 public virtual void QuickInstall(PlaceItem target)
 {
     StopTween();
     transform.position = target.transform.position;
     transform.rotation = target.transform.rotation;
     OnInstallComplete();
 }
Esempio n. 2
0
        public void UpdatePlaceState()
        {
            if (pickedUpObj == null)
            {
                return;
            }

            if (!pickedUpObj.Actived)
            {
                resonwhy    = "当前步骤无需该零件!";
                installAble = false;
            }
            else
            {
                ray  = viewCamera.ScreenPointToRay(Input.mousePosition);
                hits = Physics.RaycastAll(ray, hitDistence, PlacePoslayerMask);
                var hitedObj = false;
                if (hits != null || hits.Length > 0)
                {
                    for (int i = 0; i < hits.Length; i++)
                    {
                        installPos = hits[i].collider.GetComponentInParent <PlaceItem>();
                        if (installPos)
                        {
                            hitedObj    = true;
                            installAble = CanPlace(installPos, pickedUpObj, out resonwhy);
                            if (installAble)
                            {
                                break;
                            }
                        }
                    }
                }
                if (!hitedObj)
                {
                    installAble = false;
                    resonwhy    = "零件放置位置不正确";
                }
            }

            if (installAble)
            {
                //可安装显示绿色
                if (activeNotice)
                {
                    highLight.HighLightTarget(pickedUpObj.ViewObj, Color.green);
                }
            }
            else
            {
                //不可安装红色
                if (activeNotice)
                {
                    highLight.HighLightTarget(pickedUpObj.ViewObj, Color.red);
                }
            }
        }
        /// <summary>
        /// 动画安装
        /// </summary>
        /// <param name="target"></param>
        public virtual void NormalInstall(PlaceItem target)
        {
            StopTween();

            tweenCompleteAction = () =>
            {
                OnInstallComplete();
            };

            DoPath(target.transform.position, target.transform.eulerAngles);
        }
Esempio n. 4
0
 public bool CanPlace(PlaceItem pos, PlaceElement element, out string why)
 {
     if (pos == null)
     {
         Debug.LogError("");
         why = "【配制错误】:零件未挂PlaceObj脚本";
         return(false);
     }
     else
     {
         return(pos.CanPlace(element, out why));
     }
 }
Esempio n. 5
0
 public void PlaceObject(PlaceItem pos, PlaceElement pickup)
 {
     pos.PlaceObject(pickup);
 }