public bool CompatibleWithOtherExtreme(NailScript otherExtreme) { if (otherExtreme.thisNailRole != thisNailRole && otherExtreme.parentWindow.assignedMemberID != parentWindow.assignedMemberID) { //Debug.Log(otherExtreme.parentWindow.assignedMember.sex.ToString()); if (thisNailRole == Role.Offspring && otherExtreme.CompatibleWithOtherExtreme(this)) { return(true); } if (thisNailRole == Role.Father && FamilyManager.instance.GetMemberByID(otherExtreme.parentWindow.assignedMemberID).sex == Gender.Male) { return(true); } else if (thisNailRole == Role.Mother && FamilyManager.instance.GetMemberByID(otherExtreme.parentWindow.assignedMemberID).sex == Gender.Female) { return(true); } else { return(false); } } else { Debug.Log("That doesn't make any sense - " + otherExtreme.thisNailRole.ToString() + " _ " + thisNailRole.ToString()); return(false); } }
public void UntiePin(NailScript x) { int a = -1, b = -1; if (pointA != null) { a = pointA.parentWindow.assignedMemberID; } if (pointB != null) { b = pointB.parentWindow.assignedMemberID; } if (pointA.Equals(x)) { //pointA = null; //x.SetTiedLine(null, Extremes.None); pointA.DeleteConnection(b, this); } else if (pointB.Equals(x)) { //pointB = null; //x.SetTiedLine(null, Extremes.None); pointB.DeleteConnection(a, this); } }
public void SetB(NailScript to) { pointB = to; to.SetTiedLine(this, pointA); if (pointA != null) { pointA.UpdateConnection(this, pointB); } }
public void SetTiedLine(LineScript to, NailScript otherExtreme) { if (otherExtreme != null) { UpdateConnection(to, otherExtreme); } //else //{ // switch(thisNailRole) // { // case Role.Father: // parentWindow.assignedMember.fatherID = -1; // break; // case Role.Mother: // parentWindow.assignedMember.motherID = -1; // break; // } //} }
public void PinInteraction(NailScript pin) { if (!UI_Manager.editingInformation) { //if (currentInteraction == interactionMode.Tying) //{ if (currentStatus == pinInteractionStatus.None) { currentStatus = pinInteractionStatus.Dragging; currentLine = Instantiate(lineObject, this.transform).GetComponent <LineScript>(); currentLine.SetA(pin); currentLine.SetReady(); cancelButton.gameObject.SetActive(true); } else if (currentStatus == pinInteractionStatus.Dragging) { if (pin.CompatibleWithOtherExtreme(currentLine.pointA)) { currentStatus = pinInteractionStatus.None; if (currentLine != null) { currentLine.SetB(pin); } cancelButton.gameObject.SetActive(false); } } //} //else //{ // pin.DeleteAllTies(); //} } FamilyManager.instance.formulary.CloseFormulary(); }
private void Start() { connectedNailScript = ConnectedNail.GetComponent <NailScript>(); fixedJoint = GetComponent <FixedJoint>(); }
public void UnpinB() { pointB = null; }
public void UnpinA() { pointA = null; }
public void UpdateConnection(LineScript to, NailScript otherExtreme) { switch (thisNailRole) { case Role.Father: { if (tiedLine.Count > 0) { for (int n = tiedLine.Count - 1; n >= 0; n--) { tiedLine[n].DeleteLine(); } tiedLine.Clear(); } tiedLine.Add(to); if (otherExtreme != null) { FamilyManager.instance.SetFatherToID(parentWindow.assignedMemberID, otherExtreme.parentWindow.assignedMemberID); } break; } case Role.Mother: { if (tiedLine.Count > 0) { for (int n = tiedLine.Count - 1; n >= 0; n--) { tiedLine[n].DeleteLine(); } tiedLine.Clear(); } tiedLine.Add(to); if (otherExtreme != null) { FamilyManager.instance.SetMotherToID(parentWindow.assignedMemberID, otherExtreme.parentWindow.assignedMemberID); } break; } case Role.Offspring: { if (tiedLine.Find(x => x.Equals(to)) == null) { tiedLine.Add(to); //Debug.Log("adding child"); if (otherExtreme != null) { FamilyManager.instance.AddOffspringToID(parentWindow.assignedMemberID, otherExtreme.parentWindow.assignedMemberID); } break; } else { break; } } } }