Hässliche reuden ranz Map-Begrenzung
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LPPV_CarRotation : MonoBehaviour {
|
||||
|
||||
private float targetAngle;
|
||||
private float vel;
|
||||
private float smoothSpeed = 10f;
|
||||
|
||||
private void Start ()
|
||||
{
|
||||
if (transform.localEulerAngles.y > 0)
|
||||
{
|
||||
targetAngle = 25f + transform.localEulerAngles.y;
|
||||
}else
|
||||
{
|
||||
targetAngle = -25f - transform.localEulerAngles.y;
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate ()
|
||||
{
|
||||
Quaternion target = Quaternion.Euler (new Vector3(transform.localEulerAngles.x, targetAngle, transform.localEulerAngles.z));
|
||||
transform.rotation = Quaternion.Slerp (transform.rotation, target, Time.deltaTime * smoothSpeed);
|
||||
if (targetAngle > 0)
|
||||
targetAngle++;
|
||||
else
|
||||
targetAngle--;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d17ceb8f8c81d64a8468c596b7c2195
|
||||
timeCreated: 1570641701
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LPPV_CarSelection : MonoBehaviour {
|
||||
|
||||
public static CarType currentCarType;
|
||||
|
||||
[SerializeField] private GameObject nextButton, prevButton;
|
||||
[SerializeField] private Camera cam;
|
||||
private int currentCar = 0;
|
||||
|
||||
public enum CarType
|
||||
{
|
||||
Sedan, Sports, Utility, Bus
|
||||
}
|
||||
|
||||
private void CheckStatus()
|
||||
{
|
||||
currentCar = Mathf.Clamp (currentCar, 0, 3);
|
||||
if (nextButton == null || prevButton == null)
|
||||
return;
|
||||
|
||||
if (currentCar <= 0)
|
||||
{
|
||||
prevButton.SetActive (false);
|
||||
nextButton.SetActive (true);
|
||||
} else if (currentCar >= 3)
|
||||
{
|
||||
prevButton.SetActive (true);
|
||||
nextButton.SetActive (false);
|
||||
} else
|
||||
{
|
||||
prevButton.SetActive (true);
|
||||
nextButton.SetActive (true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (nextButton != null)
|
||||
{
|
||||
if(nextButton.GetComponent<Button>())
|
||||
nextButton.GetComponent<Button> ().onClick.AddListener (() => { currentCar++; if(cam != null) cam.transform.position = new Vector3(cam.transform.position.x + 20f, cam.transform.position.y, cam.transform.position.z);} );
|
||||
}
|
||||
if (prevButton != null)
|
||||
{
|
||||
if(prevButton.GetComponent<Button>())
|
||||
prevButton.GetComponent<Button> ().onClick.AddListener (() => { currentCar--; if(cam != null) cam.transform.position = new Vector3(cam.transform.position.x - 20f, cam.transform.position.y, cam.transform.position.z); } );
|
||||
}
|
||||
CheckStatus ();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
CheckStatus ();
|
||||
}
|
||||
|
||||
public void SelectCar()
|
||||
{
|
||||
currentCarType = (CarType)currentCar;
|
||||
SceneManager.LoadScene (1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de0dfc9e6302f1f4c867a6d17cbed27d
|
||||
timeCreated: 1570639421
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine;
|
||||
|
||||
public class LPPV_GameManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject sedan, sports, utility, bus;
|
||||
private void Start()
|
||||
{
|
||||
if (sedan == null || sports == null || utility == null || bus == null)
|
||||
return;
|
||||
|
||||
sedan.SetActive (false);
|
||||
sports.SetActive(false);
|
||||
utility.SetActive(false);
|
||||
bus.SetActive(false);
|
||||
|
||||
if (LPPV_CarSelection.currentCarType == LPPV_CarSelection.CarType.Sedan)
|
||||
sedan.SetActive (true);
|
||||
else if (LPPV_CarSelection.currentCarType == LPPV_CarSelection.CarType.Sports)
|
||||
sports.SetActive (true);
|
||||
else if (LPPV_CarSelection.currentCarType == LPPV_CarSelection.CarType.Utility)
|
||||
utility.SetActive (true);
|
||||
else if (LPPV_CarSelection.currentCarType == LPPV_CarSelection.CarType.Bus)
|
||||
bus.SetActive (true);
|
||||
}
|
||||
|
||||
public void LoadLevel(int index)
|
||||
{
|
||||
SceneManager.LoadScene (index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57e1997ac57318c488fc7c9da8832a93
|
||||
timeCreated: 1570645236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user