private void SendUnits()
 {
     if (Input.GetMouseButtonUp(1))
     {
         RaycastHit hit;
         if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
         {
             foreach (ISelectable selectable in selectionService.GetSelected())
             {
                 if (typeof(Character).IsInstanceOfType(selectable) && !typeof(Enemy).IsInstanceOfType(selectable))
                 {
                     var ally = (Character)selectable;
                     if (hit.collider.CompareTag("Terrain"))
                     {
                         ally.SetObjective(null);
                         ally.MoveToPoint(hit.point, 5f);
                     }
                     else
                     {
                         ally.SetObjective(hit.collider.transform.parent);
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
        private void Copy()
        {
            //Get the elements
            var elements = SelectionService.GetSelected()
                           .OfType <IElement>();

            ClipboardUtility.Copy(elements);
        }
        protected override void StartDrag(Point position)
        {
            SelectionService?.EnsureSelected(Selectable);

            _moveables = SelectionService?.GetSelected()
                         .OfType <IMoveable>()
                         .ToArray();

            ApplyToMoveables(m => m.StartMove());
        }
Beispiel #4
0
        private void Cut()
        {
            //Get the elements
            var elements = SelectionService.GetSelected()
                           .OfType <IElement>()
                           .ToArray();

            ClipboardUtility.Copy(elements);

            foreach (var element in elements)
            {
                element?.Parent.RemoveElement(element);
            }

            SelectionService.SelectNone();
        }
    private void Update()
    {
        DrawMoney();
        var selected = selectionService.GetSelected();

        if (selected.Count > 0)
        {
            properties.SetActive(true);
            bigPortrait.SetActive(true);
            DrawMainObjectProperties(selected[0]);
        }
        else
        {
            OnDeselect();
        }
    }
Beispiel #6
0
 private bool CanCopy()
 {
     return(SelectionService.GetSelected().Any());
 }