private void AssignWorkerToBuilding() { PlayerInformation player = buildingInstance.GetComponent <Building>().Player; var selected = FindObjectsOfType <SelectionController>() .Where(s => s.Player == player) .FirstOrDefault(); UnitActionController unit = selected.SelectedUnits .Where(u => u.GetComponent <BuildAction>() == true) .FirstOrDefault() .GetComponent <UnitActionController>(); //unit.Target(buildingInstance); }
private void SetupUnit() { _selectionController = FindObjectsOfType <SelectionController>() .Where(s => s.Player == PlayerOwner) .FirstOrDefault(); if (!_selectionController) { return; } _selectionController.SelectableUnits.Add(gameObject); _actionController = _selectionController.GetComponent <ActionRelay>(); _unitActionController = GetComponent <UnitActionController>(); _selectionProjector = GetComponentInChildren <Projector>(); }