void OnRemoteCollisionExit(CollisionListenerData data) { if (data.collision.tag != "Player") { return; } if (data.sender == LeftStartClose.gameObject && currentState == eState.FollowLeft) { currentState = eState.SlideBack; } if (data.sender == RightStartClose.gameObject && currentState == eState.FollowRight) { currentState = eState.SlideBack; } }
void OnRemoteCollisionEnter(CollisionListenerData data) { if (data.collision.tag != "Player") { return; } if (data.sender == LeftStartClose.gameObject && currentState == eState.None) { currentState = eState.FollowLeft; activeHand = data.collision.transform; } if (data.sender == RightStartClose.gameObject && currentState == eState.None) { currentState = eState.FollowRight; activeHand = data.collision.transform; } if (data.sender == EndClose.gameObject && (currentState == eState.FollowLeft || currentState == eState.FollowRight)) { //gameObject.SetActive(false); Destroy(gameObject); } }