Map selector
This commit is contained in:
@@ -7,11 +7,11 @@ public class MapSelectorScript : MonoBehaviour
|
||||
{
|
||||
public int scene;
|
||||
public void change_to_track2(){
|
||||
scene = 2;
|
||||
scene = 1;
|
||||
}
|
||||
|
||||
public void change_to_track3(){
|
||||
scene = 3;
|
||||
scene = 2;
|
||||
}
|
||||
|
||||
public void selectMap(){
|
||||
|
||||
23
Assets/Scripts/map selector script/SkyboxLoader.cs
Normal file
23
Assets/Scripts/map selector script/SkyboxLoader.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SkyboxLoader : MonoBehaviour
|
||||
{
|
||||
public Material skyboxDay;
|
||||
public Material skyboxNight;
|
||||
string skyboxToLoad;
|
||||
void Awake()
|
||||
{
|
||||
skyboxToLoad = GameObject.Find("SkyboxManager").GetComponent<TimeOfDay>().skyboxMaterial;
|
||||
Debug.Log("Skybox: " + skyboxToLoad);
|
||||
if (skyboxToLoad == "Day")
|
||||
{
|
||||
RenderSettings.skybox = skyboxDay;
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderSettings.skybox = skyboxNight;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/map selector script/SkyboxLoader.cs.meta
Normal file
11
Assets/Scripts/map selector script/SkyboxLoader.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56ccdf5df0a83eb4091e7eeb634e5d5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Scripts/map selector script/TimeOfDay.cs
Normal file
31
Assets/Scripts/map selector script/TimeOfDay.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class TimeOfDay : MonoBehaviour
|
||||
{
|
||||
public string skyboxMaterial;
|
||||
|
||||
public static TimeOfDay Instance;
|
||||
public TextMeshProUGUI MainText;
|
||||
|
||||
public void ChangeToDayTime()
|
||||
{
|
||||
skyboxMaterial = "Day";
|
||||
}
|
||||
public void ChangeToNightTime()
|
||||
{
|
||||
skyboxMaterial = "Night";
|
||||
}
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
MainText.text = "Selected time of day: \n" + skyboxMaterial;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/map selector script/TimeOfDay.cs.meta
Normal file
11
Assets/Scripts/map selector script/TimeOfDay.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab14f81283cca7e4c91a272a9773809d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user