public void SwitchMainPath(int id) { mainPath = paths[id]; playerPathFollower.SetPathCreator(mainPath); playerPathFollower.SetDistanceInPath(0); obstacleSpawner.SetPathCreator(mainPath); obstacleSpawner.SetDistanceInPath(0); obstacleDestroyer.SetPathCreator(mainPath); obstacleDestroyer.SetPathOffset(destroyerDistance); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { GameManager.instance.teleporterInScene = this.gameObject; PathCreation.Examples.PathFollower playerFollower = other.transform.parent.GetComponent <PathCreation.Examples.PathFollower>(); playerFollower.SetDistanceInPath(playerFollower.distanceTravelled - 2.5f, true); for (int i = 0; i < PlayerEntity.instance.followers.Count; i++) { PlayerEntity.instance.followers[i].SetDistanceInPath(PlayerEntity.instance.followers[i].GetComponent <PathCreation.Examples.PathFollower>().distanceTravelled - 2.5f, true); } } }