public Unit CreateUnit() { var unit = Object.Instantiate(_context.UnitPrefab); unit.PartOne = _controllerFactory.GetFirstPlayer(); unit.PartOne.Command += unit.OnCommand; unit.PartTwo = _controllerFactory.GetSecondPlayer(); unit.PartTwo.Command += unit.OnCommand; return(unit); }
public Unit CreateUnit() { var unit = Object.Instantiate(_context.UnitPrefab); unit.PartOne = _controllerFactory.GetFirstPlayer(); unit.PartOne.Command += unit.OnCommand; unit.PartTwo = _controllerFactory.GetSecondPlayer(); unit.PartTwo.Command += unit.OnCommand; unit.GetComponentInChildren <CameraController>().target = unit.transform; return(unit); }