Example #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Ball otherBall = other.GetComponent <Ball>();

        if (otherBall == null)
        {
            return;
        }
        if (otherBall.role == BallRole.Follower)
        {
            return;
        }
        else
        {
            float distanceTravelled = follower.GetDistanceTravelled() - 2.0f;
            otherBall.role = BallRole.Follower;
            NodeManager.InsertBallAfter(otherBall, GetComponent <Ball>());

            otherBall.GetComponent <Follower>().SetDistanceTravelled(distanceTravelled);
            otherBall.transform.position = follower.pathCreator.path.GetPointAtDistance(distanceTravelled);
            GameStatusManager.InsertingNode();
        }
    }