// checks if this ConductorMF is addable public bool IsAddable(ConductorMF _conductorMF, ConductorCableHandle.HandleSide currentHandleSide) { // hide tooltip tooltipSystem.ShowToolTip("Tooltip Remove DC", false); if (isOccupied) { if (audioSource) { audioSource.Play(); } return(false); } string isAddableResponse = mFController.IsAddable(_conductorMF, connectorLabel, currentHandleSide); if (isAddableResponse != "success") { if (audioSource) { audioSource.Play(); } if (isAddableResponse == "errorOnlyAC") { // show tooltip tooltipSystem.ShowToolTip("Tooltip Remove DC", true); } return(false); } return(true); }
public void AddConductor(ConductorMF _conductorMF, ConnectorLabel _connectorLabel, ConductorCableHandle.HandleSide _handleSide) { // check if it exists //if (connectorDict.ContainsKey(_connectorLabel)) return; connectorDict.Add(_connectorLabel, new ConductorInfo(_conductorMF, _handleSide)); var props = new Value(); props["Scene Name"] = SceneManager.GetActiveScene().name; Mixpanel.Track("Add Handle", props); }
void Start() { conductorMF = GetComponent <ConductorMF>(); isSnapped = false; toSnap = false; grabbableHands = GetComponent <GrabbableHands>(); rb = GetComponent <Rigidbody>(); // place at initial position if there's one referenced if (initialHook) { latestSnapStandHook = initialHook; toSnap = true; } audioSource = GetComponent <AudioSource>(); }
public void AddConductor(ConductorMF currentConductorMF, ConductorCableHandle.HandleSide currentHandleSide) { mFController.AddConductor(currentConductorMF, connectorLabel, currentHandleSide); mFController.ReDraw(); }
public ConductorInfo(ConductorMF _conductorMF, ConductorCableHandle.HandleSide _handleSide) { conductorMF = _conductorMF; handleSide = _handleSide; }
// checks if this ConductorMF is addable public string IsAddable(ConductorMF _conductorMF, ConnectorLabel _connectorLabel, ConductorCableHandle.HandleSide _handleSide) { // check if key exists if (connectorDict.ContainsKey(_connectorLabel)) { return("error"); } // if other handleside is already attached, see if it's on the same connector pair switch (_connectorLabel) { case ConnectorLabel.DC_A_POS: if (connectorDict.ContainsKey(ConnectorLabel.DC_A_NEG)) { if (connectorDict[ConnectorLabel.DC_A_NEG].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.DC_A_NEG: if (connectorDict.ContainsKey(ConnectorLabel.DC_A_POS)) { if (connectorDict[ConnectorLabel.DC_A_POS].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.DC_B_POS: if (connectorDict.ContainsKey(ConnectorLabel.DC_B_NEG)) { if (connectorDict[ConnectorLabel.DC_B_NEG].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.DC_B_NEG: if (connectorDict.ContainsKey(ConnectorLabel.DC_B_POS)) { if (connectorDict[ConnectorLabel.DC_B_POS].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.AC_A1: if (connectorDict.ContainsKey(ConnectorLabel.AC_A2)) { if (connectorDict[ConnectorLabel.AC_A2].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.AC_A2: if (connectorDict.ContainsKey(ConnectorLabel.AC_A1)) { if (connectorDict[ConnectorLabel.AC_A1].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.AC_B1: if (connectorDict.ContainsKey(ConnectorLabel.AC_B2)) { if (connectorDict[ConnectorLabel.AC_B2].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; case ConnectorLabel.AC_B2: if (connectorDict.ContainsKey(ConnectorLabel.AC_B1)) { if (connectorDict[ConnectorLabel.AC_B1].conductorMF != _conductorMF) { return("errorWrongPair"); } } break; } // if another conductor is connected, make sure to only connect same current type switch (_connectorLabel) { case ConnectorLabel.DC_A_POS: case ConnectorLabel.DC_A_NEG: case ConnectorLabel.DC_B_POS: case ConnectorLabel.DC_B_NEG: if (connectorDict.ContainsKey(ConnectorLabel.AC_A1)) { return("errorOnlyDC"); } if (connectorDict.ContainsKey(ConnectorLabel.AC_A2)) { return("errorOnlyDC"); } if (connectorDict.ContainsKey(ConnectorLabel.AC_B1)) { return("errorOnlyDC"); } if (connectorDict.ContainsKey(ConnectorLabel.AC_B2)) { return("errorOnlyDC"); } break; case ConnectorLabel.AC_A1: case ConnectorLabel.AC_A2: case ConnectorLabel.AC_B1: case ConnectorLabel.AC_B2: if (connectorDict.ContainsKey(ConnectorLabel.DC_A_POS)) { return("errorOnlyAC"); } if (connectorDict.ContainsKey(ConnectorLabel.DC_A_NEG)) { return("errorOnlyAC"); } if (connectorDict.ContainsKey(ConnectorLabel.DC_B_POS)) { return("errorOnlyAC"); } if (connectorDict.ContainsKey(ConnectorLabel.DC_B_NEG)) { return("errorOnlyAC"); } break; } return("success"); }