Map selector done
This commit is contained in:
@@ -3,23 +3,26 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class MapSelectorScript : MonoBehaviour
|
||||
{
|
||||
public GameObject[] Maps;
|
||||
GameObject currentMap;
|
||||
quaternion currentRotation;
|
||||
public GameObject CameraRotator;
|
||||
public int scene;
|
||||
public string scene = "ForestRacetrack";
|
||||
public TextMeshProUGUI TellMap;
|
||||
|
||||
void Start()
|
||||
{
|
||||
DisableAllMaps();
|
||||
SelectMap(0);
|
||||
DisableAllMaps();
|
||||
ChangeToTrack2();
|
||||
}
|
||||
private void FixedUpdate()
|
||||
{
|
||||
CameraRotator.transform.eulerAngles += Vector3.up * 0.7f;
|
||||
TellMap.text = "Selected map: \n" + scene;
|
||||
}
|
||||
|
||||
void DisableAllMaps()
|
||||
@@ -33,20 +36,18 @@ public class MapSelectorScript : MonoBehaviour
|
||||
void SelectMap(int index)
|
||||
{
|
||||
DisableAllMaps();
|
||||
|
||||
currentMap = Maps[index];
|
||||
currentMap.SetActive(true);
|
||||
Maps[index].SetActive(true);
|
||||
}
|
||||
|
||||
public void ChangeToTrack2()
|
||||
{
|
||||
scene = 2;
|
||||
scene = "ForestRacetrack";
|
||||
SelectMap(0);
|
||||
}
|
||||
|
||||
public void ChangeToTrack3()
|
||||
{
|
||||
scene = 3;
|
||||
scene = "CityRacetrack";
|
||||
SelectMap(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class TimeOfDay : MonoBehaviour
|
||||
public GameObject[] Lights;
|
||||
|
||||
public static TimeOfDay Instance;
|
||||
public TextMeshProUGUI MainText;
|
||||
public TextMeshProUGUI TellTime;
|
||||
void DisableAllLights()
|
||||
{
|
||||
foreach (GameObject light in Lights)
|
||||
@@ -42,10 +42,10 @@ public class TimeOfDay : MonoBehaviour
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
DisableAllLights();
|
||||
NightLight.SetActive(true);
|
||||
ChangeToNightTime();
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
MainText.text = "Selected time of day: \n" + skyboxMaterial;
|
||||
TellTime.text = "Selected time of day: \n" + skyboxMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user