public void OnCollision(Collider collider) { if (collider == m_startObject.transform.parent.GetComponent <BoxCollider>()) { return; } if (m_tetherState != stateType.Attached) { Debug.Log("Tether Attached to" + collider); m_tetherState = stateType.Attached; m_attachedObject = collider.gameObject; } }
public void TryRetractTether(float retractTime) { if (m_tetherState == stateType.Retracting || m_startObject == null || m_tetherHook == null) { return; } float distanceToTarget = Vector3.Distance(m_startObject.transform.position, m_tetherDestination); if (m_tetherCurrentLength < distanceToTarget) { m_tetherDestination = m_tetherHook.transform.position; } m_tetherState = stateType.Retracting; m_tetherAnimationStart = retractTime; }
public void ChangeState(stateType stateType) { m_tetherState = stateType; }