Merge branch 'master' of ooftooft.net:Racesm

# Conflicts:
#	Assets/ML-Agents/Timers/Racetrack mini_timers.json
This commit is contained in:
2024-04-26 10:08:44 +02:00
16 changed files with 1283 additions and 687 deletions

View File

@@ -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);
}

View File

@@ -10,7 +10,6 @@ public class SkyboxLoader : MonoBehaviour
void Awake()
{
skyboxToLoad = GameObject.Find("SkyboxManager").GetComponent<TimeOfDay>().skyboxMaterial;
Debug.Log("Skybox: " + skyboxToLoad);
if (skyboxToLoad == "Day")
{
RenderSettings.skybox = skyboxDay;

View File

@@ -6,26 +6,46 @@ using TMPro;
public class TimeOfDay : MonoBehaviour
{
public string skyboxMaterial = "not selected";
public GameObject DayLight;
public GameObject NightLight;
public string skyboxMaterial = "Night";
public Material DaySkybox;
public Material NightSkybox;
public GameObject[] Lights;
public static TimeOfDay Instance;
public TextMeshProUGUI MainText;
public TextMeshProUGUI TellTime;
void DisableAllLights()
{
foreach (GameObject light in Lights)
{
light.SetActive(false);
}
}
public void ChangeToDayTime()
{
NightLight.SetActive(false);
RenderSettings.skybox = DaySkybox;
DayLight.SetActive(true);
skyboxMaterial = "Day";
}
public void ChangeToNightTime()
{
skyboxMaterial = "Night";
DayLight.SetActive(false);
RenderSettings.skybox = NightSkybox;
NightLight.SetActive(true);
skyboxMaterial = "Night"; ;
}
private void Awake()
{
Instance = this;
DontDestroyOnLoad(gameObject);
DisableAllLights();
ChangeToNightTime();
}
private void Update()
{
MainText.text = "Selected time of day: \n" + skyboxMaterial;
TellTime.text = "Selected time of day: \n" + skyboxMaterial;
}
}