Esempio n. 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)
                        {
                            SwitchState(installPos.CtrlType);
                            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 override void Update()
 {
     if (chargeTool != null)
     {
         if (chargeTool.charged)
         {
             if (ChargeUtil.FindChargeObj(chargeTool, out chargeObj))
             {
                 if (chargeObj != lastMatchChargeObj)
                 {
                     if (lastMatchChargeObj != null)
                     {
                         highter.UnHighLightTarget(lastMatchChargeObj.gameObject);
                     }
                     highter.HighLightTarget(chargeObj.gameObject, Color.green);
                     lastMatchChargeObj = chargeObj;
                 }
             }
             else
             {
                 if (lastMatchChargeObj != null)
                 {
                     highter.UnHighLightTarget(lastMatchChargeObj.gameObject);
                     lastMatchChargeObj = null;
                 }
             }
         }
         else
         {
             if (ChargeUtil.FindResource(chargeTool, out chargeResource))
             {
                 if (chargeResource != lastMatchChargeResource)
                 {
                     if (lastMatchChargeResource != null)
                     {
                         highter.UnHighLightTarget(lastMatchChargeResource.gameObject);
                     }
                     highter.HighLightTarget(chargeResource.gameObject, Color.green);
                     lastMatchChargeResource = chargeResource;
                 }
             }
             else
             {
                 if (lastMatchChargeResource != null)
                 {
                     highter.UnHighLightTarget(lastMatchChargeResource.gameObject);
                     lastMatchChargeResource = null;
                 }
             }
         }
     }
 }
 public override void Update()
 {
     base.Update();
     foreach (var item in viewObjects)
     {
         highLighter.HighLightTarget(item, highLightColor);
     }
 }
        private void UpdateInputEvent()
        {
            if (pickCtrl.PickUped)
            {
                pickCtrl.UpdatePickUpdObject();

                if (Input.GetMouseButtonDown(0))
                {
                    if (pickCtrl.TryStayPickUpedObject())
                    {
                        if (nodeConnectCtrl.TryConnectItem())
                        {
                            highLightCtrl.HighLightTarget(nodeConnectCtrl.TargetNode.Render, 2);
                            highLightCtrl.HighLightTarget(nodeConnectCtrl.ActiveNode.Render, 2);
                            nodeConnectCtrl.PutDownInOutItem(true);
                        }
                    }
                    highLightElement.UnHighLightTarget(pickUped.Trans.gameObject);
                }
                else if (Input.GetMouseButtonDown(2))
                {
                    if (pickCtrl.PickDownPickedUpObject())
                    {
                        nodeConnectCtrl.PutDownInOutItem(false);
                    }
                    highLightElement.UnHighLightTarget(pickUped.Trans.gameObject);
                }
            }
            else if (Input.GetMouseButtonDown(0))
            {
                if (pickCtrl.TryPickUpObject(out pickUped))
                {
                    List <INodeItem> oldItems = nodeConnectCtrl.PickUpInOutItem(pickUped.Trans.GetComponent <InOutItemBehaiver>());
                    for (int i = 0; i < oldItems.Count; i++)
                    {
                        highLightCtrl.UnHighLightTarget(oldItems[i].Render);
                    }
                    highLightElement.HighLightTarget(pickUped.Trans.gameObject, Color.clear);
                }
            }
        }
        protected void Update()
        {
            if (!notice)
            {
                return;
            }

            if (actionItem.Active)
            {
                highLighter.HighLightTarget(viewObj, highLightColor);
            }
        }
Esempio n. 6
0
        void OnMatch(LinkPort itemA, LinkPort itemB)
        {
            highter.HighLightTarget(itemA.gameObject, Color.green);
            var linkInfo = itemA.connectAble.Find(x => x.itemName == itemB.Body.Name && x.nodeId == itemB.NodeID);

            LinkUtil.ResetTargetTranform(itemA.Body, itemB.Body, linkInfo.relativePos, linkInfo.relativeDir);
            LinkUtil.UpdateBrotherPos(itemA.Body, new List <LinkItem>());
            if (linkItem)
            {
                linkItem.isMatching = true;
            }
        }
 protected virtual void Update()
 {
     if (!Config.highLightNotice)
     {
         return;
     }
     if (m_render == null)
     {
         return;
     }
     if (actived)
     {
         highLighter.HighLightTarget(m_render, highLightColor);
     }
     else
     {
         highLighter.UnHighLightTarget(m_render);
     }
 }
Esempio n. 8
0
        protected override void Update()
        {
            base.Update();

            UpdateMatchTime();

            if (m_render == null)
            {
                return;
            }

            if (Active)
            {
                highLighter.HighLightTarget(m_render, highLightColor);
            }
            else
            {
                highLighter.UnHighLightTarget(m_render);
            }
        }
        protected override void Update()
        {
            base.Update();

            if (!Config.highLightNotice)
            {
                return;
            }
            if (m_render == null)
            {
                return;
            }
            if (actived)
            {
                highLighter.HighLightTarget(m_render, highLightColor);
            }
            else
            {
                highLighter.UnHighLightTarget(m_render);
            }
        }
 void OnMatch(LinkPort item)
 {
     highter.HighLightTarget(item.gameObject, Color.green);
 }