public bool CanTractor(RopeLink link) { if (m_State != State.Idle) { return(false); } var go = link.gameObject; if (null == m_Links || m_Links.Count < 5) { return(false); } if (go == m_Links[0]) { return(m_CanTractorFirstLink); } if (go == m_Links[m_Links.Count - 1]) { return(m_CanTractorLastLink); } return(false); }
public float RopePositionFromLink(RopeLink rl) { for (int i = 0; i < m_Links.Count; i++) { if (m_Links[i] == rl.gameObject) { return(i); } } return(0.0f); }
public void OnConnectJoint(RopeLink link, Joint joint, GameObject newConnection, GameObject oldConnection) { var myPC = GetComponent <PowerConduit>(); if (myPC != null) { if (oldConnection != null) { var oldPC = oldConnection.GetComponent <PowerConduit>(); myPC.Disconnect(oldPC); } if (newConnection != null) { var yourPC = newConnection.GetComponentInSelfOrParents <PowerConduit>(); if (yourPC != null) { myPC.Connect(yourPC); } } } }
public void CheckRefund(RopeLink link) { if (m_RefundItem.IsEmpty()) { return; } foreach (var player in ComponentList.GetCopiedListOfType <ThirdPersonUserControl>()) { if ((player.transform.position - link.transform.position).magnitude < 1.0f) { int amountCouldntGive = player.Inventory.AddInventory(new InventoryEntry(m_RefundItem, 1), true); if (amountCouldntGive == 0) { DisconnectAndDestroy(); return; } } } return; }