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>(); }
public void SetPlayer(PlayerInformation player) { if (_player == null) { _player = player; _selectionController = FindObjectsOfType <SelectionController>() .Where(s => s.Player == _player) .FirstOrDefault(); if (!_selectionController) { return; } _selectionController.SelectableBuildings.Add(gameObject); } }
private void Start() { Cursor.SetCursor(cursorTexture, hotSpot, cursorMode); FindObjectOfType <UnitRaycaster>().UpdateActiveLayer += SetMouseCursor; _selectionController = GetComponentInChildren <SelectionController>(); }