public void AttachFriend(FriendMover newFriend) { // Scoring ScoringManager.save_Score += 100; // FloatingFriends 에서 찾고, 제거하고 FloatingFriends.Remove(newFriend); // MovingFriends에 넣고 FriendMover head = MovingFriends[MovingFriends.Count - 1]; float thetaAhead = DistanceBetweenFriends / head.Radius; if (head.IsClockwise) { thetaAhead *= -1.0f; } Vector2 centerToCurrent = (Vector2)head.transform.position - head.CircleCenter; Vector2 centerToTarget = new Vector2( Mathf.Cos(thetaAhead) * centerToCurrent.x - Mathf.Sin(thetaAhead) * centerToCurrent.y, Mathf.Sin(thetaAhead) * centerToCurrent.x + Mathf.Cos(thetaAhead) * centerToCurrent.y ); newFriend.transform.position = head.CircleCenter + centerToTarget; newFriend.transform.rotation = Quaternion.identity; FriendMover newFriendMover = newFriend.GetComponent <FriendMover>(); newFriendMover.Speed = head.Speed; newFriendMover.state = FriendMover.eState.Moving; newFriendMover.indexFromHead = 0; newFriendMover.CircleCenter = head.CircleCenter; newFriendMover.IsClockwise = head.IsClockwise; MovingFriends.Add(newFriendMover); for (int i = MovingFriends.Count - 2; 0 <= i; --i) { MovingFriends[i].indexFromHead++; } }