Signed-off-by: magn9775 <magnusd2005@gmail.com>

This commit is contained in:
magn9775
2024-04-23 15:40:28 +02:00
parent 1d032920da
commit 784bfaff4d
8 changed files with 62 additions and 147 deletions

View File

@@ -17,14 +17,12 @@ public class CameraControl :MonoBehaviour
int ActivePresetIndex = 0;
CameraPreset ActivePreset;
public GameObject Loader;
public GameObject TargetCar;
GameController GameController { get { return GameController.Instance; } }
float SqrMinDistance;
Vector3 TargetPoint
{
get
@@ -41,10 +39,19 @@ public class CameraControl :MonoBehaviour
}
}
public void getCar(GameObject car)
{
TargetCar = car;
}
private void Awake() {
CamerasPreset.ForEach (c => c.CameraHolder.SetActive(false));
UpdateActiveCamera ();
//TargetCar = Loader.GetComponent<CarLoader>().targetcar;
if (NextCameraButton)
{
NextCameraButton.onClick.AddListener (SetNextCamera);
@@ -67,8 +74,12 @@ public class CameraControl :MonoBehaviour
}
}
private IEnumerator Start ()
{
// TargetCar = Loader.GetComponent<CarLoader>().targetcar;
while (GameController == null)
{
yield return null;

View File

@@ -10,7 +10,9 @@ public class CarLoader : MonoBehaviour
string carType;
string carColor;
public Material[] Colors;
public CinemachineVirtualCamera vcam;
public GameObject cam;
public GameObject targetcar;
void Start()
{
carType = GameObject.Find("Car Data").GetComponent<CarData>().carType;
@@ -30,8 +32,8 @@ public class CarLoader : MonoBehaviour
car.GetComponent<carcontrolv2>().enabled = true;
car.GetComponent<AgentControllerV6>().enabled = false;
vcam.Follow = car.transform;
vcam.LookAt = car.transform;
cam.GetComponent<CameraControl>().getCar(car);
//LookAt = car.transform;
if (color == "Default")
{