private QSBTool GetToolByType(ToolType type) { if (CameraBody == null) { DebugLog.ToConsole($"Warning - Tried to GetToolByType({type}) on player {PlayerId}, but CameraBody was null.", MessageType.Warning); return(null); } var tools = CameraBody.GetComponentsInChildren <QSBTool>(); if (tools == null || tools.Length == 0) { DebugLog.ToConsole($"Warning - Couldn't find any QSBTools for player {PlayerId}.", MessageType.Warning); return(null); } var tool = tools.FirstOrDefault(x => x.Type == type); if (tool == null) { DebugLog.ToConsole($"Warning - No tool found on player {PlayerId} matching ToolType {type}.", MessageType.Warning); } return(tool); }
// Start is called before the first frame update void Start() { doVignette = false; Vignette.SetActive(false); Camera.SetActive(true); meshRenderers = CameraBody.GetComponentsInChildren <MeshRenderer>(); }
private QSBTool GetToolByType(ToolType type) { return(CameraBody?.GetComponentsInChildren <QSBTool>() .FirstOrDefault(x => x.Type == type)); }