Example #1
0
 private void SelectionViewUpdate(float obj)
 {
     if (Vector3.SqrMagnitude(Point1 - Point2) > 1)
     {
         var bounds = GetViewportBounds(camera, Point1, Point2);
         foreach (var v in RTS.SelectebleObjectManager.GetAllSelctioObjects())
         {
             if (bounds.Contains(camera.WorldToViewportPoint(v.Transform.position)))
             {
                 if (v.Tag == player.Tag)
                 {
                     if (!v.IsSelect)
                     {
                         RTS.SelectebleObjectManager.AddSelectonObject(v);
                     }
                 }
             }
             else
             {
                 if (v.Tag == player.Tag)
                 {
                     if (v.IsSelect)
                     {
                         RTS.SelectebleObjectManager.RemoveSelectonObject(v);
                     }
                 }
             }
         }
     }
     else
     {
         List <RTS.ISelectebleObject> DiSil = new List <RTS.ISelectebleObject>();
         foreach (var v in RTS.SelectebleObjectManager.GetSelectionObjects())
         {
             DiSil.Add(v);
         }
         foreach (var v in DiSil)
         {
             RTS.SelectebleObjectManager.RemoveSelectonObject(v);
         }
         RaycastHit hit;
         if (Physics.Raycast(camera.ScreenPointToRay(Point2), out hit, 1000, _selectLayers))
         {
             RTS.ISelectebleObject selecteble = hit.transform.GetComponent <RTS.ISelectebleObject>();
             if (selecteble != null)
             {
                 RTS.SelectebleObjectManager.AddSelectonObject(selecteble);
             }
         }
     }
 }
Example #2
0
 public void LoadSkilsFromUnit(RTS.ISelectebleObject selecteble)
 {
     for (int i = 0; i < SelectElllements.Length; i++)
     {
         if (i < selecteble.Skils.AllSkils.Length)
         {
             SelectElllements[i].Icon               = selecteble.Skils.AllSkils[i].Icon;
             SelectElllements[i].Action             = selecteble.Skils.AllSkils[i].Active;
             SelectElllements[i].Action            += DiactiveAll;
             selecteble.Skils.AllSkils[i].EndAction = ActiveAll;
             SelectElllements[i].gameObject.SetActive(true);
         }
         else
         {
             SelectElllements[i].gameObject.SetActive(false);
         }
     }
 }