protected override void onProcess(int familiesUpdateCount)
    {
        MoveControls    controls = _controlSystemGO.First().GetComponent <MoveControls>();
        SelectorPointer sp       = _selectorPointerGO.First().GetComponent <SelectorPointer>();

        if (sp.selectionChanged)
        {
            List <GameObject> controlled = sp.selectedGO.FindAll(go => go.CompareTag(controls.controlledTag));

            if (controlled.Count > 0)
            {
                controls.controlled = new List <MoveToDestination>();
                foreach (GameObject go in controlled)
                {
                    controls.controlled.Add(go.GetComponent <MoveToDestination>());
                }
            }
            else
            {
                controls.destination = sp.pointerPosition;
                foreach (MoveToDestination mtd in controls.controlled)
                {
                    mtd.currentDestination = controls.destination;
                }
            }
        }
    }
Beispiel #2
0
    protected override void onProcess(int familiesUpdateCount)
    {
        SelectorPointer sp = _selectorPointerGO.First().GetComponent <SelectorPointer>();

        sp.selectionChanged = false;

        if (Input.GetMouseButtonDown(0))
        {
            Camera camera = Camera.main;
            sp.selectedGO = new List <GameObject>();
            sp.selectedGO.Add(_pointedGO.First());
            sp.pointerPosition  = camera.ScreenToWorldPoint(Input.mousePosition);
            sp.selectionChanged = true;
        }
    }