mEgre
This commit is contained in:
25
Assets/Scripts/Car Loader.cs
Normal file
25
Assets/Scripts/Car Loader.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CarLoader : MonoBehaviour
|
||||
{
|
||||
public GameObject Hotrod;
|
||||
GameObject playerCar;
|
||||
void Start()
|
||||
{
|
||||
playerCar = GameObject.Find("Car Data").GetComponent<CarData>().playerCar;
|
||||
|
||||
replaceCar(Hotrod);
|
||||
|
||||
}
|
||||
|
||||
void replaceCar(GameObject car)
|
||||
{
|
||||
Transform carTransform = car.transform;
|
||||
|
||||
playerCar.transform.position = carTransform.position;
|
||||
playerCar.transform.rotation = carTransform.rotation;
|
||||
playerCar.transform.localScale = carTransform.localScale;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user